Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All
We use this micro for saving PDF file but it bypass the save kindly help me.
----------------------------------------------------------------------------------------------------------
sub ExportToPDF
printExportPDF "D:\Ashish\Dashboard.pdf"
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.Sheets("Sheet1").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.sheets("Sheet1").Print
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.GetApplication.WaitForIdle
'SendMail
end sub
'===========================================================================
Function printExportPDF(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
'===========================================================================
Regards
Ashish
help me this issue.
Regards
Ashish
Hi Ashish,
I've tested your script in a simple .qvw and the .pdf file is saved righlty.
Maybe the problem is the printer that you have selected by default, cause in your script you dont say what printeruse to print the Sheet.
This is the script I've tested:
'************************************************************************
sub ExportToPDF
printExportPDF "C:\test.pdf"
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.Sheets("SH01").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.sheets("SH01").Print
ActiveDocument.GetApplication.Sleep 2000
' ActiveDocument.GetApplication.WaitForIdle
end sub
'===========================================================================
Function printExportPDF(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 hope it helps.