Hi Andy
You must copy the macro in a module in your workbook
We use this test macro
Fill in your server in this macro in this line
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Fill in your SMTP server here"
And your e-mail address in this line
.To = "(e-mail address removed)"
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 ' 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") = "Fill in your SMTP server here"
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.From = """Ron"" <
[email protected]>"
.Subject = "Important message"
.TextBody = "Hi there" & vbNewLine & vbNewLine & _
"Good evening"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub
First we open the VBA editor with Alt-F11
Then we use Insert>Module
Copy/Paste the macro in this module (change the address in the macro to yours(for testing))
Now we use Alt-Q to go back to Excel
Then In Excel we use Alt-F8 to get the list with macro's
Select the macro and press Run
Post back if you need more help