Inserting RTF Text in a Message Body

R

Ridge Kennedy

Dear All,

Office 2003, Windows XP.

I have a VBA sub that is getting text for a news release re-formatted so it
is nice and readable when pasted into an RTF message. My sub is selecting
and copying the text. I have added code to Open an Outlook message in RTF
format.

I can't find the missing link, though, a way to "paste" the selection in the
message using code. Easy to do it manually. The Body and HTMLBody
perpoerties will only accept string data.

Can someone point me in the right direction to automate this last little mit
of the process??

Sincerely,

Ridge in New Joisey (Exit 145)
 
S

Sue Mosher [MVP-Outlook]

Selecting and copying the text from where?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
R

Ridge Kennedy

Sue Mosher said (in reply to my poorly proofed message):
Selecting and copying the text from where?

The code is being run from a module in MS-Word. I have the text in a
temporaty ActiveDocument that has been created from a word template. I can
define the text I want to use as the body of my Outlook message as a range
object, or I can select and copy it in Word.

Ridge
 
S

Sue Mosher [MVP-Outlook]

Great, because that means you can use the "Office envelope" feature to create the message directly from the Word document -- no copy and paste required:

Set env = ActiveDocument.MailEnvelope
Set itm = env.Item ' this is the Outlook message
itm.To = "(e-mail address removed)"
itm.Subject = "the subject"
itm.Send ' this will trigger a security prompt

etc.

If you want the user to be able to edit and set Outlook properties on the outgoing item, you can save the message and display it like this:

itm.Save
id = itm.EntryID
Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set msg = ns.GetItemFromID(id)
msg.Display


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
R

Ridge Kennedy

Thank you, Sue. Sorry for the delay in getting back -- got distracted.
Looks like a great solution.

Sincerely,

R.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top