Hi,
I am currently testing how to send an e-mail automatically using VBA within Outlook 2003, to start I have copied the 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 "[email protected]"
.Recipients.ResolveAll
.Display
End With
End Sub
When I run this I receive a Runtime error '287' message with the .Recipients.Add line highlighted when I select debug. If I take out the .recipients lines the code works and displays a mail with the correct title and body text but I cannot get it to add the recipients. Does anybody know what I am doing wrong?
Thanks in advance for your help. Steve