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

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
ivan_will
Partner - Creator II
Partner - Creator II

Send very simple E-Mail using macro ?!

Hi all,

How to make a vb macro to send mail! Want to send it automatically on open the document without prompting the user.

, want the subject of the mail be only one variable!

Do you have any examples of simple vb macros? I've just checked some macros for that but I do not understand VB very well ...

Many thanks in advance!

1 Reply
spividori
Specialist
Specialist

Hi Ivan.

Here's an example to send an email through a macro.
I hope to help you.

function SendMessage()

    Set objMessage = CreateObject("CDO.Message")

    objMessage.Subject = "Mensaje de QlikView"

    objMessage.From = """My Name"" <my@dir.xxx.xx>"

       

    strMailTo = "my@dir.xxx.xx;"

       

    strMailTo = left(strMailTo,len(strMailTo)-1) ' remove the last ; in list

    objMessage.To = strMailTo

    objMessage.TextBody = "Qlik Recargado" & vbCRLF & vbCRLF

   

    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xxx.xx.x.x"

    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

    objMessage.Configuration.Fields.Update

    objMessage.Send

   

end function

smtpserver = is the outgoing mail server.

In the scripts:

if nCorreo=1 then

    let dummy=SendMessage();

    let nCorreo = 0;

end if