Solved

How open pdf file from command button onclick at a certain size

Posted on 2014-04-13
7
850 Views
Last Modified: 2014-04-17
An expert helped me with a question a couple of days ago.  Here is the code he suggested which works very well.  But now I would like the pdf to open at 75% size.  How can the following code be altered to accomplish this?

private sub button_click()
DoCmd.OutputTo acOutputReport, "rptTable2", acFormatPDF, CurrentProject.Path & "\myReport.pdf"
FollowHyperlink CurrentProject.Path & "\myReport.pdf"
end sub


--Steve
0
Comment
Question by:SteveL13
  • 3
  • 2
  • 2
7 Comments
 
LVL 10

Expert Comment

by:Korbus
ID: 39997542
your will need to adjust the "followhyperlink" line to actually call adobe reader with certain command line parameters, one will specify zoom, one will specify the file.

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf

e.g.

Acrobat.exe /A "zoom=75" "C:\example.pdf"

or for adobe reader...

AcroRd32.exe  /A "zoom=75" "C:\example.pdf"
0
 

Author Comment

by:SteveL13
ID: 39998775
I'm sorry I don't follow.

How do I alter my code to make the report open at 75% size?
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39998899
Instead of using FollowHyperlink use the Shell function. I believe the following syntax will work:

Shell Chr(34) & "AcroRd32.exe /A " & Chr(34) & "Zoom=75" & Chr(34) & " " & Chr(34) & CurrentProject.Path & "\myReport.pdf" & Chr(34) & Chr(34)

Open in new window

Chr(34) is the double quote character, so essentially you're inserting that character every time you see Chr(34).
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:SteveL13
ID: 39999112
Getting error:

File not found
0
 
LVL 84
ID: 39999194
Then your path is wrong. Can you show us the full code you're using?

Often it's a good idea to pop up a msgbox when you're troubleshooting these things to make sure the path is right. You can do this to view the value you're passing to the Shell command:

Msgbox Chr(34) & "AcroRd32.exe /A " & Chr(34) & "Zoom=75" & Chr(34) & " " & Chr(34) & CurrentProject.Path & "\myReport.pdf" & Chr(34) & Chr(34)

Open in new window

0
 

Author Comment

by:SteveL13
ID: 39999354
Private Sub Command310_Click()
On Error GoTo Command310_Click_Err

    DoCmd.RunCommand acCmdSaveRecord

    GettingFilesInDir TempVars!strPicturesDataPath, Me.txtNCMRCARPAR

    DoCmd.OutputTo acOutputReport, "Non-Conform Materials", acFormatPDF, CurrentProject.Path & "\Non-Conform Materials.pdf"
   
    'Shell Chr(34) & "AcroRd32.exe /A " & Chr(34) & "Zoom=75" & Chr(34) & " " & Chr(34) & CurrentProject.Path & "\Non-Conform Materials.pdf" & Chr(34) & Chr(34)
   
    FollowHyperlink CurrentProject.Path & "\Non-Conform Materials.pdf"

Command310_Click_Exit:
    Exit Sub

Command310_Click_Err:
    MsgBox Error$
    Resume Command310_Click_Exit

End Sub
0
 
LVL 10

Expert Comment

by:Korbus
ID: 39999360
Does acrobat generate that error?  If not, perhaps you need to use the full path of adobe acrobat in your code?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now