PDFCreator using default settings, not VBA assigned settings.

Alluvian

New Member
Joined
Oct 6, 2009
Messages
10
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!

PHP:
Sub Test_Printer()
   mypage = "http://www.google.com"
   pdfname = "testpdf"
   Call PrintIE(mypage, pdfname)
End Sub
 
Private Sub PrintIE(address, outName)
Set IE = CreateObject("InternetExplorer.Application")
Dim PDFCreator1 As PDFCreator.clsPDFCreator
Set PDFCreator1 = New clsPDFCreator
With PDFCreator1
    If .cStart("/NoProcessingAtStartup") = False Then
        MsgBox "Can't initialize PDFCreator."
        End
    End If
    .cOption("UseAutosave") = 1
    .cOption("UseAutosaveDirectory") = 1
    .cOption("AutosaveDirectory") = "c:\mytemp\"
    .cOption("AutosaveFilename") = outName
    .cOption("AutosaveFormat") = 0 '= PDF
    .cClearCache
End With
'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
IE.navigate address
Do While IE.Busy
    DoEvents
Loop
Do While IE.ReadyState <> 4
    DoEvents
Loop
'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
PDFCreator1.cClose
Set PDFCreator1 = Nothing
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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?
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,257
Members
448,880
Latest member
aveternik

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