PDA

View Full Version : HTML 2 RTF



jason_kelly
11-30-2010, 03:57 PM
Hi there,

I am a little tired with receiving HTML e-mails in Outlook and would like to turn to VBA for help. When I receive e-mails with attachments in my inbox, I would like a Macro to check the formatting of the received e-mail, if the received e-mail is plain text/rtf, leave it alone, but if its HTML to convert it to RTF.


Any help with this is definetly greatly appreciated.

Thanks in advance,

Cheers! Jay.

JP2112
11-30-2010, 07:42 PM
You could start with this event code that handles all incoming messages:

http://www.codeforexcelandoutlook.com/outlook-vba/stock-event-code/

Then use this sample code to check email format and act accordingly:

http://www.codeforexcelandoutlook.com/blog/2009/12/force-outlook-replies-into-the-format-of-your-choice/

HTH

jason_kelly
12-01-2010, 09:01 AM
Thanks very much JP for this, now that I am started and headed in the right direction, the second link you provided does not seem to have anything to do with RTF, only HMTL and Plain Text, that being said, is there a way to receive an incomming message, and reply to it in RTF instead of plain text or HTML?

Thanks a bunch for all your help and support.

Jay

JP2112
12-10-2010, 07:42 AM
Highlight a message you want to reply to and use this code:

Sub ReplyRTF()
Dim msg As Outlook.MailItem
Dim newMsg As Outlook.MailItem
Set msg = ActiveExplorer.Selection.Item(1)
Set newMsg = msg.Reply

With newMsg
.BodyFormat = olFormatRichText
.Display
End With
End Sub

If it doesn't work, reverse the BodyFormat and Display method calls.

HTH