Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Send an object via e-mail with macro?

Hi.

I have to send every day an e-mail with and object. I know it can be done with a macro, but i tried a few options that i read in the internet and they didn't work.

Thank you

Regards,

6 Replies
consenit
Partner - Creator II
Partner - Creator II

Hi there.

Your requirement could be done much better and more professionally using NPrinting.

Otherwise you'll have to use the QlikView API to export the object to an image file and then sent that using Outlook.

Kind regards,

Ernesto.

Not applicable
Author

I think it can be done with macros. Am i wrong?

Regards,

consenit
Partner - Creator II
Partner - Creator II

It CAN be done with macros but that's the hard way of doing things IMHO. You have to be fluent in the VBScript language and know the QlikView object model thoroughly. Besides macros are a very old feature that's being deprecated by Qlik.

Check out this for examples; there's one macro to export to Excel (exporting a chart to JPG or PNG should be done in a similar fashion) and another to send mail using Google.



QlikView Macros – Useful collection | Lucian Cotea

Kind regards,

Ernesto.

Not applicable
Author

Thanks,

Ok i think it may be something like this:

send the email with an embebed html code

Regards,

everest226
Creator III
Creator III

i found this

QlikView Macros – Useful collection | Lucian Cotea

SUB SendMail

Dim objEmail

Const cdoSendUsingPort = 2 ' Send the message using SMTP

Const cdoBasicAuth = 1 ' Clear-text authentication

Const cdoTimeout = 60 ' Timeout for SMTP in seconds

  mailServer = "smtp.gmail.com"

  SMTPport = 465

  mailusername = "MyAccount@gmail.com"

  mailpassword = "MyPassword"

  mailto = "destination@company.com"

  mailSubject = "Subject line"

  mailBody = "This is the email body"

Set objEmail = CreateObject("CDO.Message")

Set objConf = objEmail.Configuration

Set objFlds = objConf.Fields

With objFlds

  .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort

  .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailServer

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPport

.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

  .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = cdoTimeout

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasicAuth

.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = mailusername

.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = mailpassword

  .Update

End With

objEmail.To = mailto

objEmail.From = mailusername

objEmail.Subject = mailSubject

objEmail.TextBody = mailBody

objEmail.AddAttachment "C:\report.pdf"

objEmail.Send

Set objFlds = Nothing

Set objConf = Nothing

Set objEmail = Nothing

END SUB

Not applicable
Author

Hi

Thank you I got that to work perfectly but the one thing I can not get to work is to add a str file to the above macro

How can I add

'Set the path where the excel will be saved

     'strDate = Year([Snapshot Date]()) &"-"& month([Snapshot Date]())

    

'Save the file and quit excel

     'curWorkBook.SaveAs "C:\Graphs\Report_"&strDate&".xlsx"