MS Outlook 12 Library error from Access 2007

A

ARC

Thanks again, Bill R, for helping me get Outlook to load from my last post!

Now that I'm testing, I'm trying to use the automation code below to create
a message from Access 2007. I have the MS Outlook 12 Library referenced in
my code. I have the following code:

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(SendAddr)


I put a break, and stepped through. On the last line, the "Set ojbOutlook
Recip = .recipients.add(SendAddr)" statment, the code is bombing with an
error 287 "Application Defined or Object-Defined error..."

Any ideas?

Thanks!
 
A

ARC

This is interesting...

Just for grins, I tried opening Outlook 2007 first, then running the e-mail
code below. It worked!

In previous versions, you didn't need to have Oultook open, it would simply
work in the backround. It appears that you now need to open Outlook first,
then switch to access, execute the function in order for the code below to
work.

I wonder if there is a setting for this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top