Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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.
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
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.
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.
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):
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.
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.
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.