M
Macro not running as intended
I'm getting an error when I am using this macro:
Sub AA_CDO()
Dim iMsg As Object
Dim iConf As Object
' 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/sendusing") = 2
'
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"(e-mail address removed)"
'
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
' .Update
' End With
With iMsg
Set .Configuration = iConf
.To = "(e-mail address removed); (e-mail address removed)"
.CC = "(e-mail address removed)"
.BCC = ""
.From = """Excel"" <[email protected]>"
.Subject = "Important message"
.TextBody = "AA has reached its stop loss" & vbNewLine & vbNewLine & _
"Please review this position immediately."
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub
Any thoughts?
Sub AA_CDO()
Dim iMsg As Object
Dim iConf As Object
' 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/sendusing") = 2
'
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"(e-mail address removed)"
'
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
' .Update
' End With
With iMsg
Set .Configuration = iConf
.To = "(e-mail address removed); (e-mail address removed)"
.CC = "(e-mail address removed)"
.BCC = ""
.From = """Excel"" <[email protected]>"
.Subject = "Important message"
.TextBody = "AA has reached its stop loss" & vbNewLine & vbNewLine & _
"Please review this position immediately."
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub
Any thoughts?