troubleshooting Question

Access Outlook Mail

Avatar of shieldsco
shieldscoFlag for United States of America asked on
Microsoft OfficeOutlookMicrosoft Access
11 Comments1 Solution188 ViewsLast Modified:
I'm was using the code below to send Outlook 2010 emails form Access 2010. We recently upgraded to Office 2016 and now I get a runtime error 287 on line  Signature = olMailItem.HTMLBody
Thanks



Error 287


 Private Sub DoEmail(Fname As String, Lname As String, Email As String, attach As String)

    Dim olApp As New Outlook.Application
    Dim olMailItem As Outlook.MailItem
    Dim a As Variant
    Dim Signature As String
    Set olMailItem = olApp.CreateItem(0)
   
   
   
    With olMailItem
   .Display
    End With
    Signature = olMailItem.HTMLBody

    olMailItem.To = Email
    olMailItem.Subject = "Monthly Reports"
    olMailItem.HTMLBody = "Find attached your Monthly Cognos and/or eCAPE Monthly Reports. If you have questions please let me know." & "</br></br></br>" & Signature
   
   
    For Each a In Split(attach, ",")
        If Dir(a) <> "" Then
            olMailItem.Attachments.Add a
        End If
    Next
   
   
   olMailItem.Display
   ' olMailItem.Send

    Set olMailItem = Nothing
    Set olApp = Nothing


End Sub
ASKER CERTIFIED SOLUTION
shieldsco

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros