J
Johnny
I am using Ron DeBruin's CDO_Mail_Auto routine. I would like to call
this routine from another VBA routine. I want to pass the value of
cell A1 and cell A3 into CDO_Mail_Auto, so that the value of those
cells become part of the emailed message.
Basically, I want to evaluate a cell at A7 for "TRUE" or "FALSE", and
if "TRUE", send an email about that row of data, specifically with the
contents of A1 and A3.
I'll attach my working copy of CDO_Mail_Auto here, with the email and
password info XXXXX'd out. Any help would be appreciated.
Thanks
John
--------------------------------------------
Sub CDO_Mail_Auto()
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/
sendusername") = "(e-mail address removed)"
.Item("http://schemas.microsoft.com/cdo/configuration/
sendpassword") = "XXXXXXX"
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/
sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpserverport") = 25
.Update
End With
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With iMsg
Set .Configuration = iConf
.To = "XXXXXXXXX"
.CC = ""
.BCC = ""
' Note: The reply address is not working if you use this Gmail
example
' It will use your Gmail address automatic. But you can add
this line
' to change the reply address .ReplyTo = "(e-mail address removed)"
.From = """XXXXXXXX"" <[email protected]>"
.Subject = "Important message"
.TextBody = strbody
.Send
End With
End Sub
this routine from another VBA routine. I want to pass the value of
cell A1 and cell A3 into CDO_Mail_Auto, so that the value of those
cells become part of the emailed message.
Basically, I want to evaluate a cell at A7 for "TRUE" or "FALSE", and
if "TRUE", send an email about that row of data, specifically with the
contents of A1 and A3.
I'll attach my working copy of CDO_Mail_Auto here, with the email and
password info XXXXX'd out. Any help would be appreciated.
Thanks
John
--------------------------------------------
Sub CDO_Mail_Auto()
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/
sendusername") = "(e-mail address removed)"
.Item("http://schemas.microsoft.com/cdo/configuration/
sendpassword") = "XXXXXXX"
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/
sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpserverport") = 25
.Update
End With
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With iMsg
Set .Configuration = iConf
.To = "XXXXXXXXX"
.CC = ""
.BCC = ""
' Note: The reply address is not working if you use this Gmail
example
' It will use your Gmail address automatic. But you can add
this line
' to change the reply address .ReplyTo = "(e-mail address removed)"
.From = """XXXXXXXX"" <[email protected]>"
.Subject = "Important message"
.TextBody = strbody
.Send
End With
End Sub