A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

macro to include email signature



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 20th 10, 01:04 PM
steve sharpe steve sharpe is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2010
Posts: 6
Default macro to include email signature

I have attached the following code to a button on the quick access 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
Ads
  #2  
Old May 20th 10, 08:33 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default macro to include email signature

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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"steve sharpe" wrote in message
...

I have attached the following code to a button on the quick access 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




--
steve sharpe


  #3  
Old May 21st 10, 01:07 PM
steve sharpe steve sharpe is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2010
Posts: 6
Default

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

Quote:
Originally Posted by Ken Slovak - [MVP - Outlook] View Post
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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"steve sharpe" wrote in message
...

I have attached the following code to a button on the quick access 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




--
steve sharpe
  #4  
Old May 21st 10, 05:25 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default macro to include email signature

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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"steve sharpe" wrote in message
...

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


  #5  
Old June 2nd 10, 12:41 PM
steve sharpe steve sharpe is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2010
Posts: 6
Default

Thanks Ken. That worked Your'e a star!

Regards

Steve

Quote:
Originally Posted by Ken Slovak - [MVP - Outlook] View Post
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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"steve sharpe" wrote in message
...

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
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create macro to insert signature into email... Fuel451 Outlook and VBA 8 December 31st 09 03:26 PM
Include Signature or V Card when performing email merge V Burke Outlook - Using Contacts 1 January 23rd 07 03:29 AM
Include Signature or V Card when performing email merges V Burke Outlook - Using Contacts 1 January 15th 07 05:18 PM
include link with signature Curtis Outlook - Using Contacts 1 May 3rd 06 02:45 AM


All times are GMT +1. The time now is 05:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.