Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print multiple hyperlinked pdf files from excel vba

Status
Not open for further replies.

msriman

Programmer
Aug 5, 2010
5
US
I have a list of pdf files (hyperlinked) and I am trying to print them all when the user selects a 'print all' button. I do not want them to view the pdf document. They would just need to print them. I have also added individual command buttons that need to print each pdf document in the list or 'select some' from the list.
I have exhausted all methods. The Shell command works in opening the document but does not print. I would also like to bring up the print dialog box so the user can select their printer or options of duplex printing before the print job starts. (the printer dialog needs to come only once before the batch printing starts). I can do this for word documents (.doc) but not for pdf. All my users have pdf reader in their machines. Any help will be greatly appreciated. Thanks.
 
to Lameid: thanks for looking into this.

So if my code reads something like

dim sFile as string

sFile = "
ShellExecute 0, "open", sFIle, vbNullString, vbNullString, 1

how do I set it with the /t code?. The above code works to open the file in the internet location specified. But if I substitute the verb 'print' for 'open', it does nothing.

And also, I want it to print to the default printer.
thanks,
 
When you referenced the shell command I figured you meant Shell and not shellexecute...


So the command line example reads...

AcroRd32.exe /p pathname

Using shell that would be...


Code:
Shell "AcroRd32.exe /p [i]pathname[/i]"

Having not tried it I am unsure whether the path will take a URL... that may take some more research or downloading the file first.

Let us know what you find.

I just realized that this will prompt you for how to print every Acrobat file and since shell is asynchronous it will try to print a bunch in a row with a bunch of dialog boxes... You might want to find the Wait...Shell function (one word not combined here to eliminate this from searches) it is code that uses file handles and the shell function to run synchronously.
 
i will try this and see how it works.
also, is there a way to print .mdi files? i can substitute pdf files for mdi ones.
thanks
 
Since Microsoft Digital Image files are Microsoft, I would start by trying to find something on the MSDN website. You might have better luck finding objects for programmatically executing it there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top