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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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
mightygingerAuthor Commented:
I have resolved this myself. Thanks.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.