xjetjockey
06-10-2008, 08:39 AM
I have a befuddling Run-time error when trying to run a simple email routine. I get the following error:
"Run-time error '-2147417851 (80010105)':
Method 'Send' of object '_MailItem' failed"
Here is the Sub
Sub SendEmail()
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
Set OutlookApp = New Outlook.Application
Set MItem = OutlookApp.CreateItem(olMailItem)
With MItem
.To = "myemailaddress@gmail.com"
.Subject = "Subj"
.Body = "This is an email test."
.Send
End With
End Sub
I'm using VBA 6.5 and Excel 2007. Any clue as to what the problem is?
Thanks.
Robert Cooper
Edit: VBA tags added to code
"Run-time error '-2147417851 (80010105)':
Method 'Send' of object '_MailItem' failed"
Here is the Sub
Sub SendEmail()
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
Set OutlookApp = New Outlook.Application
Set MItem = OutlookApp.CreateItem(olMailItem)
With MItem
.To = "myemailaddress@gmail.com"
.Subject = "Subj"
.Body = "This is an email test."
.Send
End With
End Sub
I'm using VBA 6.5 and Excel 2007. Any clue as to what the problem is?
Thanks.
Robert Cooper
Edit: VBA tags added to code