PDA

View Full Version : Add signature to email



Lartk
03-08-2013, 12:33 PM
Is there a way to write a code within this one that will automatically put my signature to the end of the email?

Sub EmailAAM()
Const FILE_ATTACH As String = _
"G:\KL\MBWB\AAA.xls"
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Dim Lastrow As Long
Dim bodyText As String
Dim i As Long


Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True


Set oMailItem = oOutlook.CreateItem(0)

With oMailItem

Set oRecipient = .Recipients.Add("test@aol.com")
oRecipient.Type = 1

.CC = "test@aol.com"

.Subject = "YOU BUY"

.body = " List. Please see the attached document for item details." & vbNewLine & vbNewLine & _
"can." & vbNewLine & vbNewLine & _
"Let me know if you need anything else." & vbNewLine & vbNewLine & _
"Thanks."

If Dir(FILE_ATTACH, vbNormal) <> "" Then

.Attachments.Add ("G:\KL\MBWB\AAA.xls")
.Save
End If

End With

End Sub

Doug Robbins
03-08-2013, 07:09 PM
How about just include the text of your signature in the .body of the message.

AFAIK, there is no Signature item that can be added to a MailItem.

Lartk
03-11-2013, 07:46 AM
Well the issue is, normally when I go into outlook and create a new message, my signature is automatically included in the message. But when I generate a new email from the above macro, for some reason my signature is not included in that email. Although I could just make my siganture in the .body of the message, this macro is being used my two people so I am trying to generalize it so we run this macro without having to change the signature at the bottom of the email. I would essentially have to create two similar macros, one with .body of his name, etcc.. and one with .body with my name, etc.. So I am trying to not use the .body and just have a command that inserts the signature for the outlook being used.

HaHoBe
03-11-2013, 09:42 AM
Hi, Lartk,

maybe this article may help with your issue: Insert Outlook Signature in mail (http://www.rondebruin.nl/mail/folder3/signature.htm).

CIao,
Holger

Doug Robbins
03-11-2013, 01:21 PM
Also see Ken Puls' article at:

http://www.excelguru.ca/content.php?249-Easy-Outlook-Email-Integration