Maureen said:
I need to create a macro in Outlook 2002 to change the mail format
from HTML
to rich text and another to change it back to HTML. Can anyone
help?
Hi,
The code below will take you from any format (other than already RTF)
to RTF. You should be able to amend to do what you want.
You'll need to amend the folder names too depending on whether the
files and deleted items are in a PST or not.
HTH,
Alan.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Sub Convert_To_RTF()
Dim ConvertItem As MailItem
Dim OriginalItem As MailItem
Dim FolderCollection As Folders
Dim AlanMainMailFileFolders As Folders
Set FolderCollection = Application.GetNamespace("MAPI").Folders
Set AlanMainMailFileFolders = FolderCollection("Alan - Main Mail
File").Folders
' Max items found by trial and error to be greater than 238
' Not sure how many it could handle in one go, but I put in 200 to
play it safe
' Probably related to your PC too?
If ActiveExplorer.Selection.Count > 200 Then
MsgBox "Too many items to do them all at once. Please select
fewer items."
Exit Sub
End If
On Error Resume Next
For Each ConvertItem In ActiveExplorer.Selection
' Check if an OlMail item class and not already RTF
If ((ConvertItem.Class = 43) And Not
(ConvertItem.GetInspector.EditorType = olEditorWord)) Then
Set OriginalItem = ConvertItem.Copy
OriginalItem.Move AlanMainMailFileFolders("Deleted Items")
ConvertItem.Body = ConvertItem.Body & " "
ConvertItem.Save
End If
Next
On Error GoTo 0
MsgBox "Finished converting " & ActiveExplorer.Selection.Count & "
MailItems to RTF"
End Sub
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
--
The views expressed are my own, and not those of my employer or anyone
else associated with me.
My current valid email address is:
(e-mail address removed)
This is valid as is. It is not munged, or altered at all.
It will be valid for AT LEAST one month from the date of this post.
If you are trying to contact me after that time,
it MAY still be valid, but may also have been
deactivated due to spam. If so, and you want
to contact me by email, try searching for a
more recent post by me to find my current
email address.
The following is a (probably!) totally unique
and meaningless string of characters that you
can use to find posts by me in a search engine:
ewygchvboocno43vb674b6nq46tvb