Print exisiting PDF (1 Viewer)

sambucaman

Registered User.
Local time
Today, 12:04
Joined
May 6, 2010
Messages
41
Hi everyone.

Is there any vba code for a button to open, and then print an existing PDF on my local machine. For example, c:\test.pdf

I've googled loads, but cant seem to get anything working.
Win XP, access 2003.

Thanks in advance. :)
 

bob fitz

AWF VIP
Local time
Today, 20:04
Joined
May 23, 2011
Messages
4,719
The following code will open the PDF file. I have tried it and it worked for me :).
Code:
Dim str As String ' this is the path to the file
str = "C:\"  'path to .pdf
Application.FollowHyperlink str & "Test.pdf"

To print a PDF file I found this in a google search:
This VBA code will print a PDF document whose fullpath is passed in as the argument. The "/P" command line option tells Acrobat to print. The user will only see the "select printer" dialog. There may be an Acrobat reader command-line option to print to the default printer so that the printer dialog box doesn't even open, but I don't know what it is.


Sub Print_PDF(sDocumentFullPath as string)
Dim sAcrobatReaderExe As String ' full path to the Acrobat reader executable
sAcrobatReaderExe = "C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe"
RetVal = Shell(sAcrobatReaderExe & " /P " & Chr(34) & sDocumentFullPath & Chr(34), 0)
End Su
in this thread: http://www.techrepublic.com/forum/discussions/51-190834

Hope this helps.
 

Users who are viewing this thread

Top Bottom