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.
mightygingerAsked:
Who is Participating?
 
mightygingerConnect With a Mentor Author Commented:
I have resolved this myself. Thanks.
0
 
game-masterCommented:


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

game-master
0
 
mightygingerAuthor Commented:
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.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
game-masterCommented:


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
0
 
mightygingerAuthor Commented:
Primo is definately installed. E-mail gingerthistle@gmail.com - thank you.
0
 
game-masterCommented:

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
0
 
mightygingerAuthor Commented:
I am using visual basic for applications and not vb6. Do you have a solution using VBA code?
0
 
mightygingerAuthor Commented:
Can anyone else help?
0
 
game-masterCommented:


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
0
 
MarceloroyoCommented:
Sorry, but what's the point of this site if you don't publish the solution...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.