PDA

View Full Version : printing pdf's i open thru excel vba



dinotom
08-29-2009, 07:40 PM
I have 2 files(PDF's) that I open via a macro that runs when excel opens (its
in my start up). Every morning when I get in I print them manually. Can I add
to that macro so that excel vba tells them to print? I see a lot of stuff on
printing on google and in help but it all seems to relate to sheets in excel
and not pdf's or other files you open outside excel.

Thanks

mdmackillop
08-30-2009, 02:01 AM
You can print them using Acrobat with a Shell command.

dinotom
08-30-2009, 02:33 AM
I found a solution thank you

mdmackillop
08-30-2009, 03:15 AM
Can you post it for the benefit of others who read this?

dinotom
08-30-2009, 06:19 AM
Well I thought I did but it doesn't work. Still searching.

mdmackillop
08-30-2009, 07:30 AM
If you have Acrobat Reader, check the version and path for your installation. This should print to your default printer
Sub PrintPdf()
Dim Pth As String
Pth = "C:\AAA\test.pdf"
Shell "c:\program files\adobe\reader 9.0\reader\acrord32.exe /p /h " & Pth
End Sub

dinotom
08-30-2009, 08:15 AM
Thank you. I can get it to print once its saved. I am trying not to bother saving it but just printing it once I've navigated to it in IE. Where I am having trouble is having it print it(the PDF) while it is open in IE.
thank you for all your assistance so far.

mdmackillop
08-30-2009, 08:48 AM
Are you using Excel VBA to navigate and open pdf files? If so can you post your code.