Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Mail pdf report


Hi all,

     I have a qvw file which contains a report. I want to mail this report as pdf attachment. I searched for soluton in this community. Below is what i taked macro script. But it didn't work . Any suggestion please?

SUB MailReport

    DIM objEmail

    DIM varDate

    DIM v

    SET v = ActiveDocument.Variables("vDate")

varDate = v.GetContent.STRING

    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 = "[SMTP Server]"

    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 = "[Recipient AddressDuo.Zhou@sanofi.com]"        'Email Recipient

    'objEmail.Cc = "[Insert Email]" 'Carbon Copy Recipient

    objEmail.From = "[Sender Address]"                        'Email Sender

    objEmail.SUBject = "QlikView Automated Excel Report"                        ' Subject

    objEmail.TextBody = "QV Report - Excel File Attached. This email is an automated procedure generated by QlikView."        'Text Body         

    objEmail.AddAttachment   "D:\test.xlsx"    ' Attachment

    objEmail.SEND

    SET objFlds = NOTHING

    SET objConf = NOTHING

    SET objEmail = NOTHING

END SUB

Labels (1)
1 Reply
Anonymous
Not applicable
Author

You might want to try the mail option on the Qlikview Publisher to send the report out after the reload finishes.