Solved

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

Posted on 2014-04-13
7
874 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

821 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