Hi there, I have been at this for days. I need to save a report to a specified file etc. The simplest script I can get from other numerous examples is this -
sub printRP01 printReportPDF "C:\TestPDF\myreport.pdf" ActiveDocument.PrintReport "RP01", "QlikviewPDF", false end sub
Function printReportPDF(pdfOutputFile) Set WSHShell = CreateObject("WScript.Shell") WSHShell.RegWrite "HKCU\Software\QlikviewPDF\OutputFile", pdfOutputFile, "REG_SZ" WSHShell.RegWrite "HKCU\Software\QlikviewPDF\BypassSaveAs", "1", "REG_SZ" Set WSHShell = nothing End function
I have tried all sorts of variations of this but it just won't save RP01 to myreports.pdf in C:\TestPDF.
Hi Michael, thanks for the prompt response. I tried your code and the suggestion from cfrench. Both scripts run but no file gets saved into the C:\TempPDF directory.
Could it be QlikviewPDF printer settings or something? I have set the default printer to QlikviewPDF and run the script. The printer shows that it is printing a file, but no file in the C:\TempPDF directory.
Steve Check if the directory exists. QV will not create it if it doesn't exist. Next, chck the permissions. Maybe you cannot write there. What happens if you try to save as PDF manually, without macro?
The directory exists with full read/write permissions. I also tried changing the directory. When I Print to PDF, it runs as usual, dialog box opens, choose print and it asks for a location and file name. It's the strangest thing. I paused the printing and looked in the files properties but couldn't find what or where it was printing.
One thing I haven't mentioned is that I am running Windows 7. I am going to try it on Windows XP tomorrow. Will let you know the outcome.
I couldn't wait for tomorrow. I ran it on a laptop with Windows XP and it runs perfectly! There must be a setting in Windows 7 somewhere that is preventing the file from saving. I am going to get one of my technical boffins to set me with XP using virtual machine or some other plan.