![]() |
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) |
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) |
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 |
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 |
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