-
Aug 5th, 2010, 01:05 PM
#1
Thread Starter
New Member
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.
-
Aug 5th, 2010, 01:38 PM
#2
Re: print multiple hyperlinked pdf files from excel vba
Are you wanting to do this from within Excel?
-
Aug 5th, 2010, 01:50 PM
#3
Thread Starter
New Member
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.
-
Aug 5th, 2010, 01:52 PM
#4
Thread Starter
New Member
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.
-
Aug 5th, 2010, 01:59 PM
#5
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.
-
Aug 5th, 2010, 02:06 PM
#6
Thread Starter
New Member
Re: print multiple hyperlinked pdf files from excel vba
-
Aug 5th, 2010, 03:39 PM
#7
-
Aug 5th, 2010, 04:37 PM
#8
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?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 5th, 2010, 10:46 PM
#9
Thread Starter
New Member
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.
-
Aug 5th, 2010, 10:55 PM
#10
Thread Starter
New Member
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.
-
Aug 6th, 2010, 04:21 AM
#11
Re: print multiple hyperlinked pdf files from excel vba
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.?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Aug 6th, 2010, 09:24 AM
#12
Thread Starter
New Member
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.
-
Aug 6th, 2010, 09:25 AM
#13
Thread Starter
New Member
Re: print multiple hyperlinked pdf files from excel vba
to koolsid: also, I have vb 6.5 in my machine. thnx.
-
Aug 6th, 2010, 12:44 PM
#14
Thread Starter
New Member
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.:
-
Aug 6th, 2010, 02:15 PM
#15
Thread Starter
New Member
Re: print multiple hyperlinked pdf files from excel vba
oops. i had a duplicate entry here (same subject matter as the one above).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|