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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto convert to Rich Text

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi,

I am trying to use the following macro to automatically convert emails that aren't in Rich Text to Rich Text when they arrive in Outlook:

Dim WithEvents olkInboxItems As Outlook.Items

Private Sub Application_Quit()
Set olkInboxItems = Nothing
End Sub

Private Sub Application_Startup()
Set olkInboxItems = Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub olkInboxItems_ItemAdd(ByVal Item As Object)
If Item.Class = olMail Then
If Item.BodyFormat <> olFormatRichText Then
Item.BodyFormat = olFormatRichText
Item.Save
End If
End If
End Sub


This doesn't work for some reason however I change the last bit to :

If Item.BodyFormat <> olFormatHTML Then
Item.BodyFormat = olFormatHTML
Item.Save
End If

Then it means all emails that aren't HTML get converted to HTML. Basically the problem is why it's not recognising olFormatRichText.

Any ideas?

Thanks very much

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top