VBA Signature

Neilster

Registered User.
Local time
Today, 04:19
Joined
Jan 19, 2014
Messages
218
Hi Guy's

Anyone shed some light on this, I'm trying to pick up the signatuer from Outlook and I'm getting nothing.

Private Sub cmdEmail_Proposal_Click()


If IsNull(Me.txtEmailAddress) Or Me.txtEmailAddress = "" Then
MsgBox "You must have a valid email address before sending emails.", vbOKOnly + vbInformation

End If

If Not IsNull(Me.txtEmailAddress) Or Me.txtEmailAddress = "" Then

On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim oblectAttachemnt As Outlook.Attachment

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.Display
End With

Signature = objEmail.Body
With objEmail

.To = Me.EmailAddress
.Subject = ""


.Body = "Dear " & Me.ContactTitle & " " & Me.FirstName & vbNewLine & _
"" & vbNewLine & _
"Best Regards,"
.Display

End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End If

End Sub
 
Hi Neil

You will need to use CreateItemFromTemplate method. 1st create a template in Outlook. then instead of using
Code:
Set objEmail = objOutlook.CreateItem(olMailItem)
use
Code:
Set objEmail = objOutlook.CreateItemFromTemplate("Path To Template")
 
Hi Guy's

Anyone shed some light on this, I'm trying to pick up the signatuer from Outlook and I'm getting nothing.

This bit
Code:
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.Display
End With

Signature = objEmail.Body
With objEmail

.To = Me.EmailAddress
.Subject = ""


.Body = "Dear " & Me.ContactTitle & " " & Me.FirstName & vbNewLine & _
"" & vbNewLine & _
"Best Regards," [COLOR="Red"]& Signature [/COLOR]
.Display

End With
You have forgotten to add the default signature back in.
 
NICE ONE Minty!! Thanks all for your help. I can't beleive I missed the signature bit out.
 

Users who are viewing this thread

Back
Top Bottom