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