rpeare
11-08-2001, 07:20 AM
Howdy all, I found this code posted by sethindeed but it is not working for me. I get the following error as soon as it hits the
.to = ... line
___________
Private Sub Command1_Click()
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
With objMailItem
.To = "someone@another.com"
.Subject = "Testing Email Attachments"
.Body = "This is the body of this message"
.CC = "someoneelse@another.com"
.Attachments.Add "C:\windows\desktop\test.txt"
End With
objMailItem.Send
Set objMailItem = Nothing
Set objOutlook = Nothing
End Sub
___________
The error I'm getting is:
Runtime Error 91: Object Variable or With Block Variable Not Set
I've got the following reference and component checked off:
Microsoft Outlook Express 5.0 Type Library
I haven't ever tried sending email with code before so I have no idea where to look for the answer.
Thanks for any help you can offer
.to = ... line
___________
Private Sub Command1_Click()
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
With objMailItem
.To = "someone@another.com"
.Subject = "Testing Email Attachments"
.Body = "This is the body of this message"
.CC = "someoneelse@another.com"
.Attachments.Add "C:\windows\desktop\test.txt"
End With
objMailItem.Send
Set objMailItem = Nothing
Set objOutlook = Nothing
End Sub
___________
The error I'm getting is:
Runtime Error 91: Object Variable or With Block Variable Not Set
I've got the following reference and component checked off:
Microsoft Outlook Express 5.0 Type Library
I haven't ever tried sending email with code before so I have no idea where to look for the answer.
Thanks for any help you can offer