Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
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