View Single Post
  #4  
Old July 31st 07, 09:56 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Insert 'Standard Text' to a reply message

That's what I thought you wanted, since your original code replaced HTMLBody. In other words, Outlook is doing exactly what you're telling it to do -- creating a new reply and replacing the normal reply text with the text you specific. If instead you want to insert your text into the body, you'll need to parse the HTMLBody property of the reply item and insert your text where you want it to appear, e.g. after the body tag (which may have attributes).

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"OU_MartynF" wrote in message ...
Thanks Sue but it is still firing up a new message rather than including the
original message text below.

Regards

Martyn

"Sue Mosher [MVP-Outlook]" wrote:

Try using more complete HTML:

.HTMLBody = "htmlbodypStandard text block here/p/body/html"

"OU_MartynF" wrote in message news
I am trying to insert a block of standard text into a reply message.

Basically when I receive a message I would like to be able to click on reply
and then run a macro that will insert a standard block of text. I have found
some code that nearly works but instead of replying to the original message
it creates a new email to the sender and retains the subject field. It does
however insert the standard text.

It it possible to retain the original message text somehow ?

I am using Outllook 2003 and this is my code

Sub InsertText()
Dim objApp As Outlook.Application
Dim objMsg As Outlook.MailItem
On Error Resume Next

Set objApp = CreateObject("Outlook.Application")
Set objMsg = objApp.ActiveInspector.CurrentItem.Reply

With objMsg
.BodyFormat = olFormatHTML
.HTMLBody = "pStandard text block here/p"
End With

objMsg.Display

Set objMsg = Nothing
Set objApp = Nothing
End Sub


Thanks in advance.

Martyn


Ads
 

Exchange Newsgroups - TurboTax Software - Remortgages - Loans - Facebook Proxy