This is a discussion on PDFCreator using default settings, not VBA assigned settings. within the Excel Questions forums, part of the Question Forums category; The code below runs without any errors, but it prints to the PDFCreator default settings (my documents, with the filename ...
The code below runs without any errors, but it prints to the PDFCreator default settings (my documents, with the filename being the title of the document) instead of the settings that I assign to the pdfcreator object in the code.
I have my windows default printer set to the pdfcreator because to my knowledge you cant assign a different printer with execwb.
My purpose is to print to pdf about 1000 html pages. And I have to do this within IE because the pages have non-printing sections so they look different when printed than when viewed normally.
Any ideas why my settings are not working here? I never get anything in the C:\mytemp folder, and the name is never right. In fact, since I already have the default printer set to pdfcreator, the code below works exactly the same as if I had removed all references to the pdfcreator object.
Is there something in the pdfcreator UI that I have to enable to allow other programs to adjust its settings? As you can see below, I even tried printing the active page to see if the pdfcreator object only worked when using excel, but that also printed to the default directory, and not the one in the code.
Any help is greatly appreciated, thankyou!
mypage = "http://www.google.com"
pdfname = "testpdf"
Call PrintIE(mypage, pdfname)
Private Sub PrintIE(address, outName)
Set IE = CreateObject("InternetExplorer.Application")
Dim PDFCreator1 As PDFCreator.clsPDFCreator
Set PDFCreator1 = New clsPDFCreator
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator."
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = "c:\mytemp\"
.cOption("AutosaveFilename") = outName
.cOption("AutosaveFormat") = 0 '= PDF
'test to check if pdfprinting works in excel correctly
'even within excel, the PDFCreator uses its default settings and not the ones assigned above.
'ActiveSheet.PrintOut Copies:=1, ActivePrinter:="PDFCreator"
'code to open web address and wait for it to finish loading
Do While IE.Busy
Do While IE.ReadyState <> 4
'reminder to add code for setting and resetting default printer (currently using 'PDFCreator' as windows default)
'print from internet explorer, do not query user (uses default printer)
IE.ExecWB 6, 2
Set IE = Nothing
Set PDFCreator1 = Nothing
Just a bump to put some more eyes on this before I try a linked cross-post tomorrow.
Would I have better luck on the PDFCreator forums?