I have a macro in Excel that creates multiple email drafts with Excel attachments. I am trying to get around having to allow access to Microsoft Outlook and avoid the below box: enter image description here
I want to include the default email signature in my Outlook account in these emails (multiple users run this macro, so the signatures would vary). When I use the below code with no body in my email, it works and saves the email as a draft with the appropriate signature, however, if I try to add a body to my email, the signature disappears.
Sub SendWorkBookRXFile()
Dim OutlookApp As Object
Dim OutlookMail As Object
Dim signature As String
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
Dim d As Date
d = Date
If Weekday(d) = vbMonday Then
d = d - 3
Else
d = d - 1
End If
With OutlookMail
.Display
.To = "someone@company.com"
.CC = "omeoneelse@company.com"
.subject = "Daily Pharmacy File / Claims Invoiced"
.Attachments.Add "attaching a file from my local drive"
.Close olSave
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
Does anyone have any ideas on how to avoid the above box, but include a body in the email AND the default signature of the Outlook account?