Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I want a macro to create PDF Reports. Please provide me the code and an example.
Thanks
Here you go:
Thank you so much for your help.
I found a solution for the issue. Thanks for your help Johannes Sunden.
You need to download QlikviewPDF Set from Qlikview website download page.
Once after you install the exe file in you desktop.
Use to following code to export data as PDF.
Sub GWP_Macro4r_Email
'...........PDF Export logic.............QlikViewPDF
ActiveDocument.clearall
path="\\inmchn24\ChannelMIS\Centrlal MiS\Daily Reports\Automated Reports\"
'path="D:\Qlikview\Report\"
ActiveDocument.PrintDocReport ("RP01"),"QlikViewPDF", false
set rep = ActiveDocument.GetReport("RP01")
reportFile = path & "SRO_GWP_Dashboard"&".pdf"
printReportPDF(reportFile)
ActiveDocument.GetApplication.Sleep 16000
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
Hi Jagan,
Thank you for your Help.
I am trying with above code but i got the error.
below is the image I have attached - :
Please let me know what is the issue ?
Thanks
Sanket K.
Hi, qv_jagan. You want to use code or a third party tool to help you creat PDF files?
here are some code maybe useful:
Sub Dagrapport
vReport = "QVreportname" 'Set report
vName = "reportname" 'Name of output pdf
ActiveDocument.PrintReport(vReport), "Bullzip PDF Printer", false 'Printreport
reportFile = "reportpath" & vName &".pdf" 'Setting outputname
MyPrintPDFWithBullZip(reportFile) 'Call pdf printer
ActiveDocument.GetApplication.Sleep 5000
zendDagrapport
End sub
FUNCTION MyPrintPDFWithBullZip (pdfOutputFile)
set obj = CreateObject("Bullzip.PDFPrinterSettings")
obj.SetValue "Output" , pdfOutputFile
obj.SetValue "ConfirmOverwrite", "no"
obj.SetValue "ShowSaveAS", "never"
obj.SetValue "ShowSettings", "never"
obj.SetValue "ShowPDF", "no"
obj.SetValue "RememberLastFileName", "no"
obj.SetValue "RememberLastFolderName", "no"
obj.SetValue "ShowProgressFinished", "no"
obj.SetValue "ShowProgress", "no"
obj.WriteSettings True
END FUNCTION
'===========================================================================
'===========================================================================
function zendDagrapport()
Dim objEmail
Const cdoSendUsingPort = 2 ' Send the message using SMTP
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
SMTPServer = "IP Mailserver"
Const SMTPPort = 25 ' Port number for SMTP
Const SMTPTimeout = 60 ' Timeout for SMTP in seconds
'Sending mail
Set objEmail = CreateObject("CDO.Message")
Set objConf = objEmail.Configuration
Set objFlds = objConf.Fields
With objFlds
'---------------------------------------------------------------------
' SMTP server details
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = SMTPTimeout
.Update
'---------------------------------------------------------------------
End With
objEmail.To = "to emailaddress" 'Email Recipient
objEmail.From = "from emailaddress" 'Email Sender
objEmail.Subject = "emailsubject" ' Subject
objEmail.TextBody = "emailbody" 'Text Body
objEmail.AddAttachment "link to file" ' Attachement
objEmail.Send
Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing
' msgbox ("Test Mail Sent")
end function
As for myself, I used to creat PDF with the help of a PDF SDK.
It is just one of many but I do appreciate its simple way of processing.
Besides, this site gives a lot of choices for document imaging processing.
Even though I only tried its free trial package to generate PDFs and didn′t check the cost and licensing conditions, it works great for me.
Share with you. Good luck.
Best regards,
Arron