Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Inserting RTF Text in a Message Body (http://www.outlookbanter.com/outlook-vba/10894-inserting-rtf-text-message-body.html)

Ridge Kennedy April 7th 06 07:51 PM

Inserting RTF Text in a Message Body
 
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)



Sue Mosher [MVP-Outlook] April 7th 06 08:30 PM

Inserting RTF Text in a Message Body
 
Selecting and copying the text from where?

--
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

"Ridge Kennedy" wrote in message ...
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)



Ridge Kennedy April 8th 06 04:40 AM

Inserting RTF Text in a Message Body
 
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



Sue Mosher [MVP-Outlook] April 8th 06 02:42 PM

Inserting RTF Text in a Message Body
 
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 = "
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
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Ridge Kennedy" wrote in message ...
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



Ridge Kennedy April 12th 06 03:29 PM

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

Sincerely,

R.




All times are GMT +1. The time now is 04:11 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com