Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
Regards
Nitin
Please refer sample application will help you to achieve the same.
Good Luck.
Vikas
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
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
.Update
'---------------------------------------------------------------------
End With
SET obj = ActiveDocument.GetSheetObject("CH02")
varFileName = "Testhtm.htm"
varPathFile = "F:\Testhtm.htm"
ActiveDocument.GetApplication().WaitForIdle
obj.ExportHTML varPathFile
msgbox "Created"
objEmail.To = "------------------------------"
objEmail.From = "----------------------------"
objEmail.Subject = "Test mail"
objEmail.CreateMHTMLBody "F:\Testhtm.htm"
objEmail.Send
msgbox "Mail send"
Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing
End Sub
Hi,
you can use alert option by concating all the fields in your table.
Regards,
Piyush
Tried the code but getting an error "The transport failed to connect to the server." in spite of adding the smtp address
Insert SMTP server ip number.
Vikas