![]() |
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:
I am attempting to insert specific text into the body of an HTML message using Word as the editor with VBA. However, when I change the body of the message, my signature disappears. Can someone please tell me how to keep the signature in the message while inserting additional text? I have tried several different methods but none seem to work. Here is my current code (with some failed attempts at the above goal): Dim objOLApp As Outlook.Application Dim NewMail As Outlook.MailItem Set objOLApp = New Outlook.Application Set NewMail = objOLApp.CreateItem(olMailItem) NewMail.Display NewMail.To = "CF Reports" NewMail.Subject = "Report " & Date - 1 Dim Temp As String Temp = "Hi Team, /br" & vbCrLf & vbCrLf & " Here is the latest Report. Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank you," Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody NewMail.HTMLBody = Temp 'NewMail.Body = Temp Thank you in advance, Dave |
Ads |
#2
|
|||
|
|||
![]()
Call the message's Display method, get the HTMLBody (which will have the
signature at that point), and modify HTMLBody to include your new text. If you know what the signature looks like, it may be easiest to use the Replace() function to find the beginning of the signature and replace it with your_new_text+beginning_of_signature. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "joave" wrote in message ... Hi: I am attempting to insert specific text into the body of an HTML message using Word as the editor with VBA. However, when I change the body of the message, my signature disappears. Can someone please tell me how to keep the signature in the message while inserting additional text? I have tried several different methods but none seem to work. Here is my current code (with some failed attempts at the above goal): Dim objOLApp As Outlook.Application Dim NewMail As Outlook.MailItem Set objOLApp = New Outlook.Application Set NewMail = objOLApp.CreateItem(olMailItem) NewMail.Display NewMail.To = "CF Reports" NewMail.Subject = "Report " & Date - 1 Dim Temp As String Temp = "Hi Team, /br" & vbCrLf & vbCrLf & " Here is the latest Report. Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank you," Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody NewMail.HTMLBody = Temp 'NewMail.Body = Temp Thank you in advance, Dave |
#3
|
|||
|
|||
![]()
Hi Sue,
Thank you for your reply. This is where I thought this would go (there are never any magic answers LOL). I was hoping to be able to use the picture that is in my signature without having to replace the entire body, but it looks like that will be very difficult to do. Thanks again, Dave "Sue Mosher [MVP]" wrote: Call the message's Display method, get the HTMLBody (which will have the signature at that point), and modify HTMLBody to include your new text. If you know what the signature looks like, it may be easiest to use the Replace() function to find the beginning of the signature and replace it with your_new_text+beginning_of_signature. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "joave" wrote in message ... Hi: I am attempting to insert specific text into the body of an HTML message using Word as the editor with VBA. However, when I change the body of the message, my signature disappears. Can someone please tell me how to keep the signature in the message while inserting additional text? I have tried several different methods but none seem to work. Here is my current code (with some failed attempts at the above goal): Dim objOLApp As Outlook.Application Dim NewMail As Outlook.MailItem Set objOLApp = New Outlook.Application Set NewMail = objOLApp.CreateItem(olMailItem) NewMail.Display NewMail.To = "CF Reports" NewMail.Subject = "Report " & Date - 1 Dim Temp As String Temp = "Hi Team, /br" & vbCrLf & vbCrLf & " Here is the latest Report. Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank you," Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody NewMail.HTMLBody = Temp 'NewMail.Body = Temp Thank you in advance, Dave |
#4
|
|||
|
|||
![]()
Can you direct me as to getting a picture into a signature macro in Outlook
2000 useing XP. Have done macros in excel but outlook is not same. Copying excel does not work. Am not sure where to start. Macro would then contain signature & picture when inserting into outgoing mail Thanks "Sue Mosher [MVP]" wrote: Call the message's Display method, get the HTMLBody (which will have the signature at that point), and modify HTMLBody to include your new text. If you know what the signature looks like, it may be easiest to use the Replace() function to find the beginning of the signature and replace it with your_new_text+beginning_of_signature. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "joave" wrote in message ... Hi: I am attempting to insert specific text into the body of an HTML message using Word as the editor with VBA. However, when I change the body of the message, my signature disappears. Can someone please tell me how to keep the signature in the message while inserting additional text? I have tried several different methods but none seem to work. Here is my current code (with some failed attempts at the above goal): Dim objOLApp As Outlook.Application Dim NewMail As Outlook.MailItem Set objOLApp = New Outlook.Application Set NewMail = objOLApp.CreateItem(olMailItem) NewMail.Display NewMail.To = "CF Reports" NewMail.Subject = "Report " & Date - 1 Dim Temp As String Temp = "Hi Team, /br" & vbCrLf & vbCrLf & " Here is the latest Report. Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank you," Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody NewMail.HTMLBody = Temp 'NewMail.Body = Temp Thank you in advance, Dave |
#5
|
|||
|
|||
![]() If you want to send the image with the email, you need to embed it. This example demonstrartes how to do that: http://www.vboffice.net/sample.html?...9&cmd=showitem -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Sun, 27 Dec 2009 22:03:01 -0800 schrieb Curt: Can you direct me as to getting a picture into a signature macro in Outlook 2000 useing XP. Have done macros in excel but outlook is not same. Copying excel does not work. Am not sure where to start. Macro would then contain signature & picture when inserting into outgoing mail Thanks "Sue Mosher [MVP]" wrote: Call the message's Display method, get the HTMLBody (which will have the signature at that point), and modify HTMLBody to include your new text. If you know what the signature looks like, it may be easiest to use the Replace() function to find the beginning of the signature and replace it with your_new_text+beginning_of_signature. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "joave" wrote in message ... Hi: I am attempting to insert specific text into the body of an HTML message using Word as the editor with VBA. However, when I change the body of the message, my signature disappears. Can someone please tell me how to keep the signature in the message while inserting additional text? I have tried several different methods but none seem to work. Here is my current code (with some failed attempts at the above goal): Dim objOLApp As Outlook.Application Dim NewMail As Outlook.MailItem Set objOLApp = New Outlook.Application Set NewMail = objOLApp.CreateItem(olMailItem) NewMail.Display NewMail.To = "CF Reports" NewMail.Subject = "Report " & Date - 1 Dim Temp As String Temp = "Hi Team, /br" & vbCrLf & vbCrLf & " Here is the latest Report. Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank you," Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody NewMail.HTMLBody = Temp 'NewMail.Body = Temp Thank you in advance, Dave |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
New Email Message in Outlook 2007 starts in Body of email not in To:field | [email protected] | Outlook - General Queries | 3 | March 28th 08 02:23 AM |
Adding af signature file at the end of the body text | kurt | Outlook and VBA | 3 | February 5th 08 06:03 PM |
font color in signature and email body changes | Ghostrider1965 | Outlook - General Queries | 0 | December 4th 07 05:07 AM |
Extra lines in the body when FW or RE...NOT in the signature | KimCo | Outlook - General Queries | 0 | May 10th 07 05:27 PM |
Dragging an email to the Calendar drops the email body text | yan | Outlook - Calandaring | 2 | February 1st 06 02:23 AM |