Application-Defined or Object-Defined error 287

T

Tim

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 = "[email protected]"
objMail.Subject = "test sending a form"

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

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

Tim

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,
 
Top