View Single Post
  #2  
Old July 25th 09, 01:22 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Email body and signature help

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



Ads