Using Automation to send Microsoft Outlook Message - error 287

A

Adam USAF

I've found several similar problems, but no real solutions. I have Access
2007 VBA code that sends an email using Outlook 2007. This works on my
personal computer, though not on my work (DoD) computers (run-time error
'287' at .send or at .recipients.add if I don't pull a list from a table).
The code did work when Office 2003 was utilized at work, though not after
upgrading to Office 2007. Since the code works on my personal computer (which
has Office 2007), I know that it is not a coding issue. I have explored the
Trust Center in both Outlook and Access on both my personal and work
computers to compare for differences. Every change that I was able to make at
home to match work settings still allowed the code to send the email. I'm
stumped. The ideas that I have are differing Add-ins, Service Packs not
installed on the work computers, Microsoft Outlook 12 reference not
connecting (it is listed), or the fact that I'm using a POP3 email account
from home, and a Microsoft Exchange Server account at work. I've posted the
general code below. Any pointers would be greatly appreciated. Thanks in
advance.

Private Sub Command50_Click()

Set objOutlook = Outlook.Application
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
..Subject = "Test"
..Importance = olImportanceHigh
..Recipients.Add ("(e-mail address removed)")
'.To = "(e-mail address removed)"
..Send
End With

End Sub
 
D

Dale Fye

Adam,

I'm running A2007 on a Vista box, from an Army installation, and your code
runs fine on my system (with either the .recipients.add or the .to line
enabled).

My system does popup a classification dialog, for me to confirm I want to
send the email, but it does work.

Just a thought, have you tried just using SendObjects? I know it doesn't
provide as much flexability (importance, attachments, ...) but you could show
the email after it is created, click the appropriate boxes, and then hit send.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
R

Ralph

Have you tried .Display instead of .Send ? 287 error code happens to me when
I click No to the Outlook Security message. I have also seen it when the
Google Toolbar for IE is installed.
 
Joined
Feb 14, 2009
Messages
1
Reaction score
0
I'm also working on an Air Force system and happen to be troubleshooting the same error. I had automated my Outlook 2003 backups and when we moved to Outlook 2007 I started getting the error 287 and some others. As with your code, my code runs perfectly at home. If I happen to find a solution I'll post back.

Lazydude
 

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