7 Replies Latest reply: Dec 26, 2013 11:28 AM by vikas mahajan RSS

    Auto mailer

      I have a qvw with some text in textbox object and tabular data below it. I want to create an auto mailer macro to send the textbox and the table below it in the body of the mail. I want table as a table in the mail body and not as a jpg or any image which will help me to select the data in the table from the mail body. This is just a sample, we have multiple qvw sheets with multiple objects that need to be used in the body of the mail. Need it a bit urgently.


        • Re: Auto mailer
          Nitin Gupta

          Why not you export the data in excel and then attach this to the mail.

          This can be easily done.


          You can follow the below link to find how to export data to excel and send mails through macros.....


          QlikView Macros – Useful collection | Lucian Cotea





          • Re: Auto mailer
            vikas mahajan

            Please refer sample application will help you to achieve the same.


            Good Luck.



              • Re: Auto mailer

                Hi Vikas, It seems to send the data as an attachment, but we wanted the object to pasted in the body of the mail and sent thru mail and not as an attachment

                • Re: Re: Auto mailer
                  Kabilan Kumarasamy
                  Use the below script
                  sub Sendmail
                  Dim objEmail
                      Dim strMailTo
                      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
                      Const SMTPServer = "-------------------------------------------------"
                      Const SMTPPort = 25                ' Port number for SMTP
                      Const SMTPTimeout = 60              ' Timeout for SMTP in seconds
                          'Send 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
                          End With
                          SET obj = ActiveDocument.GetSheetObject("CH02")
                                      varFileName = "Testhtm.htm"
                                      varPathFile = "F:\Testhtm.htm"
                                      obj.ExportHTML varPathFile
                                      msgbox "Created"              
                          objEmail.To = "------------------------------"
                          objEmail.From = "----------------------------"
                          objEmail.Subject = "Test mail"
                          objEmail.CreateMHTMLBody "F:\Testhtm.htm"
                          msgbox "Mail send"
                          Set objFlds = Nothing
                          Set objConf = Nothing
                          Set objEmail = Nothing
                  End Sub