How to print webpage using PrimoPDF (or alternative freeware PDF generator) in VBA
Posted on 2008-11-11
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.ExecWB 6, 2, 2, 0
Set objDoc = Nothing
Set IE = Nothing
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,