Auto email problems

Stevie p

Board Regular
Joined
Mar 8, 2009
Messages
228
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
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Yes, Run time error'-2147220960(80040220)':
The snd using configeration value is invalid.

Have tried te smtp.aol.com but same error message occurs.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,168
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top