Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Auto save the pdf created using vbscript

Hello there,

I have created the pdf of one of my qlikview reports successfully. Now i want to save that pdf file AUTOMATICALLY i.e. once the pdf is created, SAVE AS dialog should not appear. Instead the pdf file should be saved automatically at a location given in the vbscript code.

I have used FileSystemObject while creating pdf.

I need to know this URGENTLY.

Thanks in advance.

10 Replies
Anonymous
Not applicable
Author

The specifics depend very much on what you're using as PDF writer.  In general, your macro should be making changes in registry that:
1. Specify the name of the PDF file and its location
2. Bypass SaveAs

Hope you'll figure out the details.  Or try to search this forum, there were similar questions before.

Regards,
Michael

Not applicable
Author

Hi Michael,

I tried things but i am still stuck with auto saving pdf.

Can you please share any link or code with which this can be achieved?

I need this URGENTLY.

Thanks.

Anonymous
Not applicable
Author

Hi

     Using this macro you can open the saveas dialog in from in your qv file

Sub SaveAsDialog()

    Set objDialog = CreateObject("SAFRCFileDlg.FileSave")

objDialog.FileName = "C:\Scripts\Script1.vbs"

objDialog.FileType = "VBScript Script"

intReturn = objDialog.OpenFileSaveDlg

If intReturn Then

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set objFile = objFSO.CreateTextFile(objDialog.FileName)

    objFile.WriteLine Date

    objFile.Close

Else

   

End If

End sub

Regards

Ashok

Anonymous
Not applicable
Author

There are many questions like this here, and there are examples, e.g:

http://community.qlik.com/message/83596#83596

But it may be different for you, as I mentioned above it depends very much on your PDF writer.

Regards,

Michael

PS: If the question is urgent, I recommend to go to QlikTech support, in parallel to this forum.

Not applicable
Author

I am using PDF-XChange 3.0. Please share link or code and also if there are any settings required to be done in the qv report.

Anonymous
Not applicable
Author

I don't have a code for PDF-XChange, sorry.  See if you can find anything useful here.  It started from QlikPDF, but down the line there were answers regarding XChange as well (long 2-page thread):

http://community.qlik.com/thread/2039

Not applicable
Author

In the save settings of PDF-Xchange you can bypass the save as dialog and always name the file the same . Just implement code to rename/delete it before creating a new one.

Anonymous
Not applicable
Author

Correct, the bypas settings and pdf file name/location are set in the PDF-Xchange properties.  I'd recommend to use macro to rename file immediately after creating it.

Not applicable
Author

It seems as   WSHShell.RegWrite RegKey & "BypassSaveAs", 1     will only work if the report is a single page report, not a multipage report.......

This is the code I am using to save the report as a pdf:

Sub PrintPDF

Set WSHShell = CreateObject("WScript.Shell")

file = "D:\QlikView\QVApps\Development\Contact Centre\cctest.pdf"

RegKey = "HKEY_CURRENT_USER\Software\QlikViewPDF\"

WSHShell.RegWrite RegKey & "BypassSaveAs", 1

WSHShell.RegWrite RegKey & "OutputFile", file

ActiveDocument.PrintDocReport "RP02", "QlikViewPDF"

ActiveDocument.GetApplication.Sleep 6000

WSHShell.RegWrite RegKey & "BypassSaveAs", 0

WSHShell.RegWrite RegKey & "OutputFile", ""

Set WSHShell = nothing

End sub

The Save as pop up box always appears when the report is a multipage report but doesn't appear if it's a single page report.

Does anyone have a solution to this?

Thanks.