Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

Thread Tools Rate Thread Display Modes
Old 05-06-2012, 04:42 AM   #1
Newly Registered User
Join Date: May 2010
Posts: 41
Thanks: 5
Thanked 0 Times in 0 Posts
sambucaman is on a distinguished road
Print exisiting PDF

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.

sambucaman is offline   Reply With Quote
Old 05-06-2012, 07:33 AM   #2
bob fitz
Join Date: May 2011
Location: Essex England
Posts: 3,489
Thanks: 50
Thanked 678 Times in 661 Posts
bob fitz has a spectacular aura about bob fitz has a spectacular aura about bob fitz has a spectacular aura about
Re: Print exisiting PDF

The following code will open the PDF file. I have tried it and it worked for me .
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.
Bob Fitzpatrick
Microsoft Community Contributor Award (2011)
If this helped, please click the scales at the bottom left of this posting.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Many thanks.

I have never failed. I have found a thousand ways that do not work!
bob fitz is offline   Reply With Quote
The Following User Says Thank You to bob fitz For This Useful Post:
le5691 (05-03-2014)

button , code , print , print pdf , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open exisiting excel file torquay Forms 5 04-25-2008 06:14 AM
Looking up exisiting records homeguard Forms 2 02-16-2007 08:43 AM
Creating budgets from already exisiting entries? sugar05 Tables 1 12-08-2006 02:55 AM
Edit an Exisiting Record from a Form tmort Forms 1 08-11-2005 03:03 PM
Input form that does not show exisiting records cinders Forms 6 08-29-2003 07:19 AM

All times are GMT -8. The time now is 08:28 PM.

Microsoft Access Help
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post

Sponsored Links

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World