Need to Print Embedded PDFs

kmackie1

New Member
Joined
Jul 30, 2013
Messages
14
Here is my code so far:

Public Sub PrintPDFFiles()​
Const ADOBEPATH As String = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe"​
Const FILE_PATH As String = "C:\Users\kmackie\Desktop\Sample\Test"​
Const FILE_EXT As String = "PDF"​

Dim fso, fld, file​

Set fso = CreateObject("Scripting.FileSystemObject")​
Set fld = fso.GetFolder(FILE_PATH)​

For Each file In fld.Files​
If UCase(Right(file.Name, 3)) = FILE_EXT Then​
Shell """" & ADOBEPATH & """/n /t """ & file.Path & """"​
End If​
Next​
End Sub

This code works perfectly for what I am trying to do... except for one thing:

I want to open and print PDFs that are already embedded into my worksheet. I can use the code to open the embedded PDF files:


ActiveSheet.Shapes("Object 1").OLEFormat.Activate​

How on earth can I just open these files and print them. I've spent so long trying to figure this out. If you can't tell... I'm a bit of a newbie.

End result:
I want to be able to click a button, have it open the embedded pdf file in Adobe Reader, Print it, Close Adobe Reader.
I will name my first born son to the man that can solve this problem for me!
 
Re: Need to Print Embedded PDFs - PLEASE HELP :(

Error: Can't save embedded object to C:\users\Mackie\Downloads
Do you see any files with SHS extension in that folder or just new file(s) like "fragment" or so?
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Re: Need to Print Embedded PDFs - PLEASE HELP :(

I don't think so. I went through all of the files twice and didn't see anything new.
 
Upvote 0
Re: Need to Print Embedded PDFs - PLEASE HELP :(

I get the same error, but a different folder. You think maybe its just my laptop giving me issues?
 
Upvote 0
Re: Need to Print Embedded PDFs - PLEASE HELP :(

I get the same error, but a different folder. You think maybe its just my laptop giving me issues?
Not sure what is the exact reason of issue. It works on my PC.
Hope someone else will test the code.
Another way is possible with a lot of API code and the usage of Clipboard, but it's not for today, may be tomorrow.
 
Last edited:
Upvote 0
Re: Need to Print Embedded PDFs - PLEASE HELP :(

Well I am using my old lapton at home at the moment. I'll definitely be testing this first thing in the morning when I get to work and hopefully it will work. If not I'd be very grateful if you were willing to try the other method. I'd also be happy to compensate you for your time! A huge thanks again and hopefully its just something screwy with this old laptop. I'll post tomorrow morning and let you know!
 
Upvote 0
Re: Need to Print Embedded PDFs - PLEASE HELP :(

I'm at work now and for some reason am still having the same issue, on a different computer. (Both with your sheet and mine.) Here is a screen shot of the error I am getting.
Error.jpg


Thanks for any insight! I was really hoping that we had the answer. :(
 
Upvote 0
Re: Need to Print Embedded PDFs - PLEASE HELP :(

Didn't work for me as well, got the same problem
 
Upvote 0

Forum statistics

Threads
1,215,374
Messages
6,124,566
Members
449,171
Latest member
jominadeo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top