Application-Defined or Object-Defined error 287

  • Follow


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 = "John.Doe@school.com"
    objMail.Subject = "test sending a form"
    
    objMail.Attachments.Add "C:\Temp\StudentForms\" & FileName
    
'On Error Resume Next
    objMail.Send
    Set objOutlook = Nothing


0
Reply Utf 4/9/2010 2:51:01 PM

Take a look at

http://www.devhut.net/index.php?lang=en&pid=0000000013#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 = "John.Doe@school.com"
>     objMail.Subject = "test sending a form"
>     
>     objMail.Attachments.Add "C:\Temp\StudentForms\" & FileName
>     
> 'On Error Resume Next
>     objMail.Send
>     Set objOutlook = Nothing
> 
> 
0
Reply Utf 4/10/2010 2:38:01 PM


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=en&pid=0000000013#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 = "John.Doe@school.com"
> >     objMail.Subject = "test sending a form"
> >     
> >     objMail.Attachments.Add "C:\Temp\StudentForms\" & FileName
> >     
> > 'On Error Resume Next
> >     objMail.Send
> >     Set objOutlook = Nothing
> > 
> > 
0
Reply Utf 4/12/2010 6:55:01 PM

2 Replies
1879 Views

(page loaded in 0.154 seconds)

Similiar Articles:













8/1/2012 6:07:16 AM


Reply: