Question Locked

Access 2000 send email

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello, everybody, Im brand new in this forum, I would like to receive guidence in how I can send emails using Access 2000, using the Outlook object.

this is the code I tried but did not work
I received an error :" Run-time error '91'
Object variable or With block variable not set

Private Sub Command2_Click()
Dim appOutlook As Outlook.Application
Dim msg As Outlook.MailItem

Set msg = appOutlook.CreateItem(olMailItem)
msg.To = Recipient
msg.Subject = "test"
msg.Body = "funcionando papa"
msg.Send

End Sub

Thanks,
JP

3 replies

by scott_heath

Use the debugger to run one line at a time. Find the line with the issue. Double check your syntax. Use Google to find examples.

by wayne.essel

JP,

I think that if you add the word "NEW" before outlook.application as in the following:

dim appOutlook as New Outlook.Application

This might fix your issue.

Wayne

This discussion is closed to new replies.