I am testing how to send an e-mail. I have copied the code below from the help files:
Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties'
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item'
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.Subject = "Test Message"
.Body = "Body Text"
.Recipients.Add "xyz@abc.com"
.Recipients.ResolveAll
.Display
End With
End Sub
I receive a Runtime error '287' message with the .Recipients.Add line highlighted. What am I doing wrong?