Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have created several qilk view repors which i need to email to staff. Now i export the report to excel and then email. Is there a way the report can be email direct from the qvw. Pls let me know
Hello,
Try This :
' Mail PDF report
Function MailPDFReport(sReportName,sPDFFile,oDistList)
' Get distribution list
aDistList = GetPossibleValues(oDistList)
iCount = UBound(aDistList) - 1
If iCount < 0 Then Exit Function
sDistList = aDistList(0)
For i = 1 To iCount
sDistList = sDistList & ";" & aDistList(i)
Next
' Create e-mail configuration
Set oMessage = CreateObject("CDO.Message")
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = GetVariable("SMTPServer")
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport ") = GetVariable("SMTPPort")
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
oMessage.Configuration.Fields.Update()
' Create e-mail message
oMessage.Subject = "QlikView Report - " & sReportName
oMessage.From = GetVariable("SMTPSender")
oMessage.To = sDistList
oMessage.TextBody = "QlikView Report - " & sReportName
oMessage.AddAttachment sPDFFile
' Send e-mail message
oMessage.Send()
' Clean up
Set oMessage = Nothing
End Function
Regards