Link to home
Start Free TrialLog in
Avatar of mightyginger
mightyginger

asked on

How to print webpage using PrimoPDF (or alternative freeware PDF generator) in VBA

Hi,

I am trying to print a webpage to a PDF file using PrimoPDF. I am happy to look at another program if you have a solution for that. I'm not using Acrobat as users may not have this. In addition users are unlikely to have Office 2007 so need a third party solution.

So far I am happy printing the website itself. Code to do that would be

Sub PrintWebsite(webAddress As String)
    Dim IE As Object, objDoc As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate webAddress
    IE.ExecWB 6, 2, 2, 0
    Set objDoc = Nothing
    Set IE = Nothing
End Sub

I also haven't had much success in setting the print to being PrimoPDF. I have tried
    Set Application.Printer = Application.Printers("PrimoPDF")   - error: Object doesn't support this property or method
and Application.ActivePrinter = "PrimoPDF" produces an error too

So how can I set the printer to be PrimoPDF and manipulate the Printer dialogue box so that I can pass it a string with where to print the file? In addition there are various standards of quality available such as "Screen", "Print", "ebook" etc. Now I am happy with Print but since I am asking the question I might as well ask if anyone knows how to select one of these so I can choose. I'm assuming I'm probably going to have to resort to some kind of Send keys method.


Thanks in advance for your help,

Neil.
Avatar of game-master
game-master
Flag of Philippines image



are u using vb.net  or vb6 to do it programmatically?

game-master
Avatar of mightyginger
mightyginger

ASKER

I am actually running this as part of a larger macro which is being run in visual basic for applications, within a copy of Excel. Sorry if that wasn't clear, couldn't find a VBA specific forum.


make sure u have installed the "PrimoPDF" in your computer..

can u give me your email address so I can send a concrete example to you.

game-master
Primo is definately installed. E-mail gingerthistle@gmail.com - thank you.

good morning!

i have sent the program to you..
but on that example, i used "PDFCreator" as my pdf writer because i dont
have "PrimoPDF" software.

Dont forget to add on the references the PrimoPDF.

Note:Replace the "PDFCreator" with "PrimoPDF". But if you dont want,
u can download the "PDFCreator" that i used then the program will run smoothly..


game-master
I am using visual basic for applications and not vb6. Do you have a solution using VBA code?
Can anyone else help?
ASKER CERTIFIED SOLUTION
Avatar of mightyginger
mightyginger

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial


good morning!

i am very sorry for the late reply..
i was out on the office and i just came back..

im glad u have solved your problems...


game-master
Sorry, but what's the point of this site if you don't publish the solution...