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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Including signature in email created with Add-In



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 31st 06, 05:05 PM posted to microsoft.public.outlook.program_addins
[email protected]
external usenet poster
 
Posts: 5
Default Including signature in email created with Add-In

Hi everyone,

I'm currently writing an Outlook add-in that creates an email for a
user after they make a few selections on a template form.

One of the things I would like to be able to do is include the
signature.

On the form there is a text box for the user to paste in the text they
want to include. The issue is, if the user leaves this box empty and
creates the email the signature will appear. However if they include
any text at all in the box, the signature doesn't appear.

I'm running Windows XP SP 2, Outlook 2003 and Visual Studio 2005.

Here is the section of code:

'*Build the Email*'
'Add user Text
myMail.Body = TextBox1.Text

I've had a few hours of searching for an answer to this, and from other
posts in this group its clear that the signature is automatically
included when a mail is created (which is the case for me) What I would
like to know is if there is any way to add text to the mail without
over writing that signature?

Thanks in Advance

Niall

  #2  
Old May 31st 06, 05:18 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Including signature in email created with Add-In

If you set .Body = whatever you will always overwrite what was there before.
Append or prepend your text:

..Body = .Body & TextBox1.Text 'append

or

..Body = TextBox1.Text & .Body 'prepend

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
ups.com...
Hi everyone,

I'm currently writing an Outlook add-in that creates an email for a
user after they make a few selections on a template form.

One of the things I would like to be able to do is include the
signature.

On the form there is a text box for the user to paste in the text they
want to include. The issue is, if the user leaves this box empty and
creates the email the signature will appear. However if they include
any text at all in the box, the signature doesn't appear.

I'm running Windows XP SP 2, Outlook 2003 and Visual Studio 2005.

Here is the section of code:

'*Build the Email*'
'Add user Text
myMail.Body = TextBox1.Text

I've had a few hours of searching for an answer to this, and from other
posts in this group its clear that the signature is automatically
included when a mail is created (which is the case for me) What I would
like to know is if there is any way to add text to the mail without
over writing that signature?

Thanks in Advance

Niall


  #3  
Old May 31st 06, 05:33 PM posted to microsoft.public.outlook.program_addins
[email protected]
external usenet poster
 
Posts: 5
Default Including signature in email created with Add-In

Thanks Ken, that seems to have worked perfectly!

  #4  
Old June 26th 06, 01:54 PM posted to microsoft.public.outlook.program_addins
[email protected]
external usenet poster
 
Posts: 5
Default Including signature in email created with Add-In

Hi Ken,

I had originally thought that this worked, but I'm afraid it doesn't.

Whether I prepend or append like you suggested, I still end up with no
signature in the new mail. Is there anything I need to import to get
this to work?

e.g. even setting .body = .body produces an email without the
signature. However, when I don't set .Body to anything, the signature
will appear.

I'm running Windows XP SP 2, Visual Studio 2005 and Office 2003. Is it
possible I'm missing something obvious, or is what I'm trying just not
possible?

Thanks in advance.

  #5  
Old June 26th 06, 02:35 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Including signature in email created with Add-In

The signature won't appear until you display the message, so you would need to use something more like:

myMail.Display
myMail.Body = TextBox1.Text & myMail.Body

Of course, if you want to preserve formatting in HTML and RTF messages, it gets a lot more complicated.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
Hi Ken,

I had originally thought that this worked, but I'm afraid it doesn't.

Whether I prepend or append like you suggested, I still end up with no
signature in the new mail. Is there anything I need to import to get
this to work?

e.g. even setting .body = .body produces an email without the
signature. However, when I don't set .Body to anything, the signature
will appear.

I'm running Windows XP SP 2, Visual Studio 2005 and Office 2003. Is it
possible I'm missing something obvious, or is what I'm trying just not
possible?

Thanks in advance.

  #6  
Old June 26th 06, 03:30 PM posted to microsoft.public.outlook.program_addins
[email protected]
external usenet poster
 
Posts: 5
Default Including signature in email created with Add-In

Hi Sue,

After doing what you suggested I can now display the signature along
with any text.

However, you must have read my mind because I would like to be able to
preserve the formatting. Would it be possible for you to point me in
the direction of an example or a tutorial on this? I've googled it for
the past few minutes with no luck. If you don't have anything to hand
it's no problem, there's no need for me to take up too much of your
time on this. (This isn't essential, more like a nice touch).

Many thanks.

  #7  
Old June 26th 06, 03:43 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Including signature in email created with Add-In

For HTML messages, use HTMLBody, not Body and insert your text into the fully tagged HTML content that already exists on the item.

For RTF messages, there are no straightforward solutions for all scenarios. See http://www.outlookcode.com/d/formatmsg.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
Hi Sue,

After doing what you suggested I can now display the signature along
with any text.

However, you must have read my mind because I would like to be able to
preserve the formatting. Would it be possible for you to point me in
the direction of an example or a tutorial on this? I've googled it for
the past few minutes with no luck. If you don't have anything to hand
it's no problem, there's no need for me to take up too much of your
time on this. (This isn't essential, more like a nice touch).

Many thanks.

 




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
Not able to add default Signature antonio Outlook and VBA 5 May 12th 06 07:32 AM
How to add signature in a single mail? anders bitzer Outlook - General Queries 1 April 10th 06 10:31 AM
Can I add a default Subject to my signature file? Aaron_I Outlook - Using Forms 0 February 23rd 06 01:11 AM
Can I add a default Subject to my signature file? Aaron_I Outlook - Installation 0 February 22nd 06 08:36 PM
Add signature to calendar meeting request markj Outlook - Calandaring 11 February 12th 06 11:33 PM


All times are GMT +1. The time now is 11:41 AM.


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.