Edit the Internet Format for a Contact

This macro allows you to determine the format (plain, html, rtf) to be used for sending emails for each of the three email addresses of a contact.

Last modified: 2006/09/11 | Accessed: 40.805  | #32
◀ Previous sample Next sample ▶
OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.

A contact in Outlook might have up to three e-mail addresses, and for every one you can determine the format that Outlook should use for sending e-mails.

Since Outlook 2000 there're the settings: a) Let Outlook decide the best sending format, b) Send using Outlook Rich Text format.

Since Outlook XP there's a third option: c) Send Plain Text only.

The information, which format to use, is written in the EntryID of each address. Using the Outlook object model, that property is read-only. If you want to change it you must use CDO 1.21 or the Redemption.

This sample shows how to change the sending format for the first e-mail address (EMail1EntryID) by using the Redemption. If you want to change the format also for the second and third address, there're yet the necessary IDs (EMail2EntryID and EMail3EntryID), so that you're able to extend the sample yourself.

tip  How to add macros to Outlook
Private Const SEND_AUTO_FORMAT = 1
Private Const SEND_RTF_FORMAT = 0

Public Sub ChangeSendingFormat()
  On Error GoTo cleanUp
  Dim Session As Redemption.RDOSession
  Dim Utils As Redemption.MAPIUtils
  Dim obj As Redemption.rdoMail
  Dim Items As Redemption.RDOItems
  Dim AdrID As Variant
  Dim PropID As Long
  Const GUID As String = "{00062004-0000-0000-C000-000000000046}"
  ' Email1EntryID
  Const ID = &H8085
  ' Email2EntryID = &H8095
  ' Email3EntryID = &H80A5

  Set Session = CreateObject("Redemption.RDOSession")

  Set Items = Session.GetDefaultFolder(olFolderContacts).Items
  If Items.Count Then
    Set Utils = CreateObject("Redemption.MapiUtils")
    Set obj = Items(1)
    PropID = Utils.GetIDsFromNames(obj, GUID, ID)
    PropID = PropID Or &H102

    For Each obj In Items
      If TypeOf obj Is Redemption.RDOContactItem Then
        AdrID = Utils.HrGetOneProp(obj, PropID)
        If Not IsEmpty(AdrID) Then
          AdrID(22) = SEND_AUTO_FORMAT
          Utils.HrSetOneProp obj, PropID, AdrID, True
        End If
      End If
  End If

  If Not Session Is Nothing Then
  End If
End Sub
Category-Manager Category-Manager
With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP.
email  Send a message