I use the routine below to email from Excel. I want to be able to change the Outlook signature using Excel VBA. The routine already inserts the default signature into each email. Ideally I would like to select from a list of available signatures.
Sub Send_Mail()
Dim aOutlook As Object
Dim AEmail As Object
Start:
On Error Resume Next
Set aOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If aOutlook Is Nothing Then
Answer = MsgBox("Open Outlook and select ok to continue." & vbLf & vbLf & "Or select CANCEL to abort.", vbExclamation + vbOKCancel, "Outlook is not open")
If Answer = vbCancel Then Exit Sub
GoTo Start:
End If
Set aOutlook = CreateObject("Outlook.Application")
Set AEmail = aOutlook.createitem(0)
On Error Resume Next
AEmail.display
Signature = AEmail.body
On Error GoTo 0
AEmail.Importance = 2
AEmail.Subject = "ENTER THE SUBJECT HERE"
AEmail.body = "ENTER THE BODY TEXT HERE" & vbNewLine & Signature
AEmail.Attachments.Add ActiveWorkbook.FullName
AEmail.Recipients.Add "recipientsemail@mail.com"
'AEmail.Send
AEmail.display
Set aOutlook = Nothing
Set AEmail = Nothing
End Sub
Bookmarks