PC Review


Reply
Thread Tools Rate Thread

Application-Defined or Object-Defined error 287

 
 
Tim
Guest
Posts: n/a
 
      9th Apr 2010
My codes generate the error 287 at the objMail.Send. I think the path is
wrong, but I don't know why. If I use "On Error Resume Next" above the Send,
then there is no error popping up, but there is no email sent, either. Please
show me how to fix it. Thank you.
------
strDocName = "frmStud"
DoCmd.openfORM strDocName, acPreview, , "studId='" & glbStudId & "'"
FileName = strDocName & ".pdf"
DoCmd.OutputTo acOutputForm, strDocName, acFormatPDF,
"C:\Temp\StudentForms\" & FileName, False
‘==========================================
'Using Outlook programming codes ....
'==========================================
Dim objOutlook As Object
Dim objMail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objMail = objOutlook.CreateItem(olMailItem)

objMail.To = "(E-Mail Removed)"
objMail.Subject = "test sending a form"

objMail.Attachments.Add "C:\Temp\StudentForms\" & FileName

'On Error Resume Next
objMail.Send
Set objOutlook = Nothing


 
Reply With Quote
 
 
 
 
Daniel Pineault
Guest
Posts: n/a
 
      10th Apr 2010
Take a look at

http://www.devhut.net/index.php?lang...13#OutlookAuto

For a full Outlook automation function example which you can either simply
use or use to fix your code with.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"Tim" wrote:

> My codes generate the error 287 at the objMail.Send. I think the path is
> wrong, but I don't know why. If I use "On Error Resume Next" above the Send,
> then there is no error popping up, but there is no email sent, either. Please
> show me how to fix it. Thank you.
> ------
> strDocName = "frmStud"
> DoCmd.openfORM strDocName, acPreview, , "studId='" & glbStudId & "'"
> FileName = strDocName & ".pdf"
> DoCmd.OutputTo acOutputForm, strDocName, acFormatPDF,
> "C:\Temp\StudentForms\" & FileName, False
> ‘==========================================
> 'Using Outlook programming codes ....
> '==========================================
> Dim objOutlook As Object
> Dim objMail As Outlook.MailItem
>
> Set objOutlook = CreateObject("Outlook.application")
> Set objMail = objOutlook.CreateItem(olMailItem)
>
> objMail.To = "(E-Mail Removed)"
> objMail.Subject = "test sending a form"
>
> objMail.Attachments.Add "C:\Temp\StudentForms\" & FileName
>
> 'On Error Resume Next
> objMail.Send
> Set objOutlook = Nothing
>
>

 
Reply With Quote
 
 
 
 
Tim
Guest
Posts: n/a
 
      12th Apr 2010
Hi Daniel, Thank you for the link, but for my program, it does NOT pop up the
Outlook security warning. The execution reaches "objMail.Send" code and then
jump down to these lines of codes
Err_Handler:
MsgBox Err.Description & " " & Err.Number

Where it describles the error message 287.

Do you think it's because of the configuration of the exchange
server/account? Thank you,



"Daniel Pineault" wrote:

> Take a look at
>
> http://www.devhut.net/index.php?lang...13#OutlookAuto
>
> For a full Outlook automation function example which you can either simply
> use or use to fix your code with.
> --
> Hope this helps,
>
> Daniel Pineault
> http://www.cardaconsultants.com/
> For Access Tips and Examples: http://www.devhut.net
> Please rate this post using the vote buttons if it was helpful.
>
>
>
> "Tim" wrote:
>
> > My codes generate the error 287 at the objMail.Send. I think the path is
> > wrong, but I don't know why. If I use "On Error Resume Next" above the Send,
> > then there is no error popping up, but there is no email sent, either. Please
> > show me how to fix it. Thank you.
> > ------
> > strDocName = "frmStud"
> > DoCmd.openfORM strDocName, acPreview, , "studId='" & glbStudId & "'"
> > FileName = strDocName & ".pdf"
> > DoCmd.OutputTo acOutputForm, strDocName, acFormatPDF,
> > "C:\Temp\StudentForms\" & FileName, False
> > ‘==========================================
> > 'Using Outlook programming codes ....
> > '==========================================
> > Dim objOutlook As Object
> > Dim objMail As Outlook.MailItem
> >
> > Set objOutlook = CreateObject("Outlook.application")
> > Set objMail = objOutlook.CreateItem(olMailItem)
> >
> > objMail.To = "(E-Mail Removed)"
> > objMail.Subject = "test sending a form"
> >
> > objMail.Attachments.Add "C:\Temp\StudentForms\" & FileName
> >
> > 'On Error Resume Next
> > objMail.Send
> > Set objOutlook = Nothing
> >
> >

 
Reply With Quote
 
Jill Bolig
Guest
Posts: n/a
 
      30th Sep 2010
Daniel,

Did you ever fix the problem you had with Access 2007? We are having the same problem trying to send emails through Access 2007. I have found many posts where other people were able to get the same code to work. We also think it is either an Access or an Outlook setting and we cannot figure out what it is. Have you resolved your issue?

Jill

> On Friday, April 09, 2010 10:51 AM Tim wrote:


> My codes generate the error 287 at the objMail.Send. I think the path is
> wrong, but I do not know why. If I use "On Error Resume Next" above the Send,
> then there is no error popping up, but there is no email sent, either. Please
> show me how to fix it. Thank you.
> ------
> strDocName = "frmStud"
> DoCmd.openfORM strDocName, acPreview, , "studId='" & glbStudId & "'"
> FileName = strDocName & ".pdf"
> DoCmd.OutputTo acOutputForm, strDocName, acFormatPDF,
> "C:\Temp\StudentForms\" & FileName, False
> ???==========================================
> 'Using Outlook programming codes ....
> '==========================================
> Dim objOutlook As Object
> Dim objMail As Outlook.MailItem
>
> Set objOutlook = CreateObject("Outlook.application")
> Set objMail = objOutlook.CreateItem(olMailItem)
>
> objMail.To = "(E-Mail Removed)"
> objMail.Subject = "test sending a form"
>
> objMail.Attachments.Add "C:\Temp\StudentForms\" & FileName
>
> 'On Error Resume Next
> objMail.Send
> Set objOutlook = Nothing



>> On Saturday, April 10, 2010 10:38 AM Daniel Pineault wrote:


>> Take a look at
>>
>> http://www.devhut.net/index.php?lang...13#OutlookAuto
>>
>> For a full Outlook automation function example which you can either simply
>> use or use to fix your code with.
>> --
>> Hope this helps,
>>
>> Daniel Pineault
>> http://www.cardaconsultants.com/
>> For Access Tips and Examples: http://www.devhut.net
>> Please rate this post using the vote buttons if it was helpful.
>>
>>
>>
>> "Tim" wrote:



>>> On Monday, April 12, 2010 2:55 PM Tim wrote:


>>> Hi Daniel, Thank you for the link, but for my program, it does NOT pop up the
>>> Outlook security warning. The execution reaches "objMail.Send" code and then
>>> jump down to these lines of codes
>>> Err_Handler:
>>> MsgBox Err.Description & " " & Err.Number
>>>
>>> Where it describles the error message 287.
>>>
>>> Do you think it is because of the configuration of the exchange
>>> server/account? Thank you,
>>>
>>>
>>>
>>> "Daniel Pineault" wrote:



>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>> Mocking WCF Services Using Moq
>>> http://www.eggheadcafe.com/tutorials...using-moq.aspx

 
Reply With Quote
 
New Member
Join Date: Aug 2012
Posts: 1
 
      9th Aug 2012
In case anyone is frantically searching around for this answer (like I was) I finally found what MY issue was...

Outlook has to be opened. CreateObject was not sufficient for this. When I added this to my code, it fixed the problem:
Shell "Outlook.exe" 'Opens Outlook

Bla bla code goes here

Shell "taskkill /IM Outlook.exe" 'Closes Outlook again when code is finished (optional)
 
Reply With Quote
 
New Member
Join Date: Feb 2014
Posts: 1
 
      14th Feb 2014
This "error 287" is because you have to open Microsoft outlook when you run macro. remember always open outlook when you are going to run macro because excel file uses outlook to send e-mails if outlook is not opened how do you think it will send e-mails? enjoy.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource DLL Error 1-287 Madtyke2 Windows XP 3 3rd Feb 2007 09:15 PM
Run-time error 287 Application-defined or object-defined error =?Utf-8?B?R3JlZzI1ODI=?= Microsoft Access Form Coding 2 18th May 2006 05:09 PM
Sony Application Resource DLL ERROR (1-287) =?Utf-8?B?SmVmZnJleSBURVJDSA==?= Windows XP Basics 1 21st Dec 2004 02:46 AM
Resource DLL Error (1.287) Jack Windows XP General 0 11th Oct 2004 06:15 PM
Item.Save is giving Error 287 Application or Object Defined Error =?Utf-8?B?QW5keUs=?= Microsoft Outlook VBA Programming 1 24th Feb 2004 09:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 PM.