![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
Thanks Ken, that seems to have worked perfectly!
|
#4
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |