Avatar of shieldsco
Flag for United States of America

asked on 

Access Outlook Mail

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

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
    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
   ' olMailItem.Send

    Set olMailItem = Nothing
    Set olApp = Nothing

End Sub
Microsoft OfficeOutlookMicrosoft Access

Avatar of undefined
Last Comment

8/22/2022 - Mon