macro to include email signature

S

steve sharpe

I have attached the following code to a button on the quick access ba
in Outlook. It does all I want except that "body text" erases m
default signature. Is there some additional code I could include tha
would complete the email with my default signature? The defaul
signature uses various fonts sizes and colours. Thanks for any help.

Sub inspector()

Dim myOlApp As New Outlook.Application
Dim myItem As Object
Dim myAttachments As Outlook.Attachments
Set myItem = myOlApp.ActiveInspector.currentitem
Set myAttachments = myItem.Attachments
myItem.Subject = "Status Report"
myItem.Body = "body text"
myAttachments.Add "C:\Documents and settings\etc
myItem.Display

End Su
 
K

Ken Slovak - [MVP - Outlook]

Call Display() before you add anything to the body. The signature is added
after the item is opened.

If you want to have your addition before any signature then after you call
Display() use code like this:

myItem.Body = "body text" & myItem.Body
 
S

steve sharpe

Hi Ken
Thankyou for youir reply. What have I done wrong? I think I hav
altered my code as you suggested but it does not make any difference
Here's what I wrote... Would you be kind enough to point out m
mistake?

Sub InsertMySig()
Dim myOlApp As New Outlook.Application
Dim myItem As Object
Dim myAttachments As Outlook.Attachments
Set myItem = myOlApp.ActiveInspector.currentitem
Set myAttachments = myItem.Attachments
myItem.Subject = "Status Report"
myItem.Display
myItem.Body = "body text" & myItem.Body
myAttachments.Add "C:\Documents and settings\etc"
End Sub

I look forward to hearing from you.
Best wishes

Steve

'Ken Slovak - [MVP - Outlook said:
;349233']Call Display() before you add anything to the body. Th
signature is added
after the item is opened.

If you want to have your addition before any signature then after yo
call
Display() use code like this:

myItem.Body = "body text" & myItem.Body




"steve sharpe" (e-mail address removed) wrote in messag


I have attached the following code to a button on the quick acces
bar
in Outlook. It does all I want except that "body text" erases my
default signature. Is there some additional code I could include that
would complete the email with my default signature? The default
signature uses various fonts sizes and colours. Thanks for any help.

Sub inspector()

Dim myOlApp As New Outlook.Application
Dim myItem As Object
Dim myAttachments As Outlook.Attachments
Set myItem = myOlApp.ActiveInspector.currentitem
Set myAttachments = myItem.Attachments
myItem.Subject = "Status Report"
myItem.Body = "body text"
myAttachments.Add "C:\Documents and settings\etc
myItem.Display

End Sub
 
K

Ken Slovak - [MVP - Outlook]

I'm not sure. Let's see what happens first if you comment out the line
myItem.Body = "body text" & myItem.Body. Do you get the signature then? If
so and the body format is HTML, then see if it helps to use this line
instead:

myItem.HTMLBody = "body text" & myItem.HTMLBody
 
S

steve sharpe

Thanks Ken. That worked Your'e a star!

Regards

Steve

'Ken Slovak - [MVP - Outlook said:
;349299']I'm not sure. Let's see what happens first if you comment ou
the line
myItem.Body = "body text" & myItem.Body. Do you get the signature then
If
so and the body format is HTML, then see if it helps to use this line
instead:

myItem.HTMLBody = "body text" & myItem.HTMLBody




"steve sharpe" (e-mail address removed) wrote in messag


Hi Ken
Thankyou for youir reply. What have I done wrong? I think I have
altered my code as you suggested but it does not make any difference.
Here's what I wrote... Would you be kind enough to point out my
mistake?

Sub InsertMySig()
Dim myOlApp As New Outlook.Application
Dim myItem As Object
Dim myAttachments As Outlook.Attachments
Set myItem = myOlApp.ActiveInspector.currentitem
Set myAttachments = myItem.Attachments
myItem.Subject = "Status Report"
myItem.Display
myItem.Body = "body text" & myItem.Body
myAttachments.Add "C:\Documents and settings\etc"
End Sub

I look forward to hearing from you.
Best wishes

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top