print multiple hyperlinked pdf files from excel vba
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.
Re: print multiple hyperlinked pdf files from excel vba
Re: print multiple hyperlinked pdf files from excel vba
Yes, please. I am able to open and print them without the viewer viewing them if they are Microsoft word documents. But we would like to convert them to pdf files. I am,however able to add the Shell Execute command and get it to open (the pdf document - in the internet) but when I susbsitute the verb 'print' for 'open', it doesn't do anything.
i.e. ShellExecute 0, "print", sFIle, vbNullString, vbNullString, 0 or
ShellExecute 0&, "print", cAction, "", "", 2 where sFIle and cAction are the full path of the file starting with "http.....pdf".
I have declared the Shell execute function though.
Re: print multiple hyperlinked pdf files from excel vba
I am placing all these codes in the VB project within the workbook. Another thing I would like to get around is for the entire Excel Application to close when the user closes the workbook. It closes the workbook but the Excel app remains open. I have added the Application.Quit, savechanges = false but nothing seems to work.
Re: print multiple hyperlinked pdf files from excel vba
Since you are doing this in an Office product I've moved your thread here where those kind of questiones are answered.
Re: print multiple hyperlinked pdf files from excel vba
Re: print multiple hyperlinked pdf files from excel vba
Welcome to the forums :wave:
See if this helps?
http://www.vb-helper.com/howto_print_pdf.html
The code is in vb6. Try and amend it for vba :)
Re: print multiple hyperlinked pdf files from excel vba
assuming you are using a pdf printer driver, which one?
does it display a dialog for each?
is the pdf driver your default printer?
Re: print multiple hyperlinked pdf files from excel vba
To westconn: I do not understand about the pdf print drive; I am trying to print it using our regular print method. Do I have to invoke a pdf printer?
The users eventually would need to print all these in our network drive printer, except the locations vary and hence the need to bring up the dialog box to change default printer. thnx.
Re: print multiple hyperlinked pdf files from excel vba
To koolsid: I have looked at this example but this code does not work. Believe me, I have searched the web for the past week or so and have tried everything. I have referenced all available Adobe libraries, Shell libraries and whatnots (being a newbee). But I am stumped as to how the code works to open the pdf document in the internet but is not printing. And I have not been able to invoke the printer dialog box with pdf documents at all. The dialog box comes each time durning printing word docs; even then, if I decide to stick to word docs, how do I get the user to choose one printer in the beginning before it does the printing of various documents, retains the selected printer name and prints all the documents in the same printer. Even though they print multiple files, they should see the print dialog box only once, in the beginning. Thanks.
Re: print multiple hyperlinked pdf files from excel vba
Quote:
To koolsid: I have looked at this example but this code does not work.
1) Do you have VB6?
2) Can you explain what do you mean that this code does not work.?
Re: print multiple hyperlinked pdf files from excel vba
It gives me a compile error as the App variable not defined. Also, my PDF links are not in an array. They are all in consecutive cells in a column. How do I save them in an array? It has been a decade since I coded in vb (except simple vb) and hence I am lost.
thanks.
Re: print multiple hyperlinked pdf files from excel vba
to koolsid: also, I have vb 6.5 in my machine. thnx.
Re: print multiple hyperlinked pdf files from excel vba
the code:
ShellExecute 0, "open", sFile, vbNullString, vbNullString, 0
where sFile is the full path of the pdf is working
sFile = "http://inside.xxx.com/pr_office/pr_tools/xxx.pdf"
This opens up the hyperlinked document but when I do:
ShellExecute 0, "print", sFIle, vbNullString, vbNullString, 0
it does absolutely nothing.
from what I have read, it should work, correct me if I am wrong.
Thanks.:
Re: print multiple hyperlinked pdf files from excel vba
oops. i had a duplicate entry here (same subject matter as the one above).