Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preserve Rich Text Info?

Status
Not open for further replies.

markdmac

MIS
Dec 20, 2003
12,340
US
I am working on a script that will read an RTF file and add its contents to a new message in Microsoft Outlook. My script works great if I just use a plain TXT file, but then hyperlinks don't display as I want them to where words in the email are hyperlinked.

I am currently using the FileSystemObject GetFile method and then using TextStream.ReadAll but this does not seem to work with a rich text file because my returned results include control code.
Code:
Set oMsgStream = oFSO.OpenTextFile("message.rtf")
        strMessage = oMsgStream.ReadAll

My problem it seems is that the FileSystemObject seems to only handle plain text files and I need to work with RichText.

Does anyone know of a way to capture the RTF text?

Thanks in advance.

Mark
 
A starting point:
yourMailItem.BodyFormat = 3 ' 3=olFormatRichText
yourMailItem.Body = oMsgStream.ReadAll

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the reply PHV. After adding your suggestion I still get the control codes for formatting the text in the message. I wonder if it has to do with how I am opening the file?

'get the message text
Set oMsgStream = oFSO.OpenTextFile("message.rtf",1,-1)

I also tried as posted above
Set oMsgStream = oFSO.OpenTextFile("message.rtf")

I have confirmed that the message is in RTF format, so the issue seems to be what I am reading into the messagestream is the literal code rather than what should be presented if that makes any sense.

Do you have any other suggestions?

Thanks again.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top