Using Automation to send Microsoft Outlook Message - error 287

  • Thread starter Thread starter Adam USAF
  • Start date Start date
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
 
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.
 
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.
 
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
 
Back
Top