Adding a VBA script

G

Grant

Hello List:

I have a slight problem here which I would very much
appreciate help with. Owing to certain accessibility
software that I use to read Email messages, it is easier
for me to read HTML messages than plain text messages,
even if they are the exact same font, color, etc.
I have a VBA script that will supposedly convert all
incoming plain text messages into HTML format. I have
consulted Microsoft who assure me that this can be done
with VB script.
I would like to request that somebody read my code, tell
me whether or not they think it will work and tell me
exactly (step by step please) how to add it to the This
Session module and make Outlook recognize it. Here's the
code:

Private WithEvents olInboxItems As Items

Private Sub Application_Startup()

Dim objNS As NameSpace

Set objNS = Application.GetNamespace("MAPI")

' instantiate objects declared WithEvents

Set olInboxItems = objNS.GetDefaultFolder
(olFolderInbox).Items

Set objNS = Nothing

End Sub

Private Sub Application_Quit()

' disassociate global objects declared WithEvents

Set olInboxItems = Nothing

End Sub

Private Sub olInboxItems_ItemAdd(ByVal Item As Object)

On Error Resume Next

If Item.HTMLBody <> vbNullString Then

Item.HTMLBody = Item.Body

Item.Save

End If

Set Item = Nothing

End Sub

Thanks so much,

Grant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top