Hey Friends,
This one either has to be incredibly simple or impossible to solve: Here is some sample code:
Pretty simple, right? Everywhere I look to see how to use this automation feature, this is exactly how it says to do it. But, whenever I get to the .Send line, I get error number 287: "Applicatio n-defined or object-defined error."
What am I doing wrong?
If I replace ".Send" with ".Display", all works well and I can just click send. However, this is part of a block of code that cycles through dozens of records, and I would prefer to have Outlook send the e-mail without having to click send.
Not a big deal, but incredibly mystifying! Any suggestions? BTW, everything is properly referenced.
I'm stumped!
This one either has to be incredibly simple or impossible to solve: Here is some sample code:
Code:
Public Function SendEMail()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = "Name@Domain.mail"
.Body = "Test"
.Subject = "Test"
.Send
End With
End Function
What am I doing wrong?
If I replace ".Send" with ".Display", all works well and I can just click send. However, this is part of a block of code that cycles through dozens of records, and I would prefer to have Outlook send the e-mail without having to click send.
Not a big deal, but incredibly mystifying! Any suggestions? BTW, everything is properly referenced.
I'm stumped!
Comment