Hi,
Im having problems with sending auto email. I've included the code can someone tell me what im doing wrong.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
If IsNumeric(Target.Value) And Target.Value > 200 Then
Call Mail_CDO
End If
End If
End Sub
Sub Mail_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
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/con...tion/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = "AOL.COM"
.Item("http://schemas.microsoft.com/cdo/con...smtpserverport") = 25
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "SPAINTERN1@AOL.COM"
.CC = ""
.BCC = ""
.From = """Ron"" <SPAINTERMAN1@AOL.COM>"
.Subject = "Important message"
.TextBody = "Hi there" & vbNewLine & vbNewLine & _
"Cell A1 is changed"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub
Im having problems with sending auto email. I've included the code can someone tell me what im doing wrong.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
If IsNumeric(Target.Value) And Target.Value > 200 Then
Call Mail_CDO
End If
End If
End Sub
Sub Mail_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
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/con...tion/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = "AOL.COM"
.Item("http://schemas.microsoft.com/cdo/con...smtpserverport") = 25
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "SPAINTERN1@AOL.COM"
.CC = ""
.BCC = ""
.From = """Ron"" <SPAINTERMAN1@AOL.COM>"
.Subject = "Important message"
.TextBody = "Hi there" & vbNewLine & vbNewLine & _
"Cell A1 is changed"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub