Assign a custom form to existing Outlook items

Last reviewed on September 19, 2014   —  11 comments

One of my favorite (and free!) little utilities is DocMessageClass as it makes it easy to change the message class on existing items to use a new published form. Unfortunately, it doesn't work with Outlook 2013.

Although not quite as easy to use as DocMessageClass, you can use a macro to make the change in all versions, including Outlook 2013.

Note: these methods work for any Outlook item, not just contacts.

This first macro is based off of a macro provided by Microsoft, intended to be used in a template (see the KB article for details if you want to run it from a template.

Sub ChangeContactMessageClass()
  ' Change the following line to your new Message Class
   NewMC = "IPM.Contact.Test"
   Set CurFolder = Application.ActiveExplorer.CurrentFolder
   Set AllItems = CurFolder.Items
   NumItems = CurFolder.Items.count
   ' Loop through all of the items in the folder
   For i = 1 To NumItems
      Set CurItem = AllItems.Item(i)
' Test for a distlist
 If CurItem.Class = olContact Then
      ' Test to see if the Message Class needs to be changed
      If CurItem.MessageClass <> NewMC Then
         ' Change the Message Class
         CurItem.MessageClass = NewMC
         ' Save the changed item
      End If
 End If
   MsgBox "Done."
End Sub

To use the code above with non-contact folders, remove the If CurItem.Class = olContact Then line and the second End If.

Macro alternative to DocMessageClass

This alternative to DocMessageClass was posted by chaplaindoug in Outlook Forums: How to Set Existing Contacts to Custom Form

This macro shows how to use change the message class of Public Folder contacts.

Sub ChangeMessageClass()
UName = Environ("UserName")
Set olNS = Application.GetNamespace("MAPI")
Set ContactsFolder = olNS.Folders("Public Folders - " + UName + "")
Set ContactsFolder = ContactsFolder.Folders("All Public Folders")
Set ContactsFolder = ContactsFolder.Folders("Good News Contacts")
'Set ContactsFolder = olNS.GetDefaultFolder(olFolderContacts
Set ContactItems = ContactsFolder.Items

For Each itm In ContactItems

If itm.MessageClass = "IPM.Contact" Then
itm.MessageClass = "IPM.Contact.Good News Contact"
End If

End Sub

Change message class as item is saved

If you need to change the message class on some items, you can use an ItemAdd macro to change the message class when the new item is saved.

This could be used with an If statement to change the message class according to a value in a field (for example, If = "Canada"), or when a new item is created in such a way that the custom form is not used.

Option Explicit
Private WithEvents newContacts As Outlook.Items
Private Sub Application_Startup()
 Set newContacts = Session.GetDefaultFolder(olFolderContacts).Items
End Sub

Private Sub newContacts_ItemAdd(ByVal Item As Object)
If Item.Class = "IPM.Distlist" Then Exit Sub

 Dim NewMC As String
NewMC = "IPM.Contact.MapIt"
 If Item.Class = olContact Then
      If Item.MessageClass <> NewMC Then
         Item.MessageClass = NewMC
      End If
 End If

End Sub

Change the message class when a contact is edited

This macro changes the message class when you edit and save a contact.

Public WithEvents cItems As Outlook.Items

Public Sub Initialize_handler()
    Set cItems = Application.ActiveExplorer.CurrentFolder.Items 
End Sub

Sub cItems_ItemChange(ByVal Item As Object)
  ' Change the following line to your new Message Class
   NewMC = "IPM.Contact.robert-form"
 If Item.Class = olContact Then
      If Item.MessageClass <> NewMC Then
         Item.MessageClass = NewMC
      End If
 End If
End Sub

More Information

How to update existing items in an Outlook folder to use a new custom form This code works in all versions of Outlook and can be run using Run This Form from the forms designer. However, if you use it on Contacts, it does not detect Distribution lists and turns them into contacts. The first code on the page above uses the same code and adds a check for distribution lists.

About Diane Poremsky

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlook forums by

11 responses to “Assign a custom form to existing Outlook items”

  1. Rob

    I've seen about a dozen of similar posts but *NOT ONE* actually addresses this issue for Outlook 2010. And almost every post refers to MS articles that ALSO do not refer to Outlook 2010. I have to do this for my existing Calendar items for Outlook 2010 (change the message class) and I cannot find a properly described procedure.

    1. Diane Poremsky

      The method is the same for any Outlook items type. Most methods that work in other versions of Outlook also work with 2010. My preferred method is DocMessageClass, but it won't work with 2013. For that I use the macro.

  2. Robert Ogden

    Greetings Diane and other. I have an odd issue involvin VBA code that changes the MessageClass of 'Sent Item' messages in Outlook 2010.
    The code wirks fine, updates when it is run and the icon for the targeted 'Sent Item's updates. However, when I open the message that had its Message Class changed, it still will show the previous MessageClass. I have to select another mail folder (switching to Calendar, Contacts and Tasks folders don't always work the forst time), then come back to Sent Items and then open the item to see the change.

    The odd thing is, the trigger doesn't seem consistent. I'll change the Message Class, click on the 'Contacts' folder, then come back and open the Sent Message, it hasn't changed. However, sometimes when I do this, I'll come back and open the Sent Item, and it has changed. I've also let it sit for several minutes, but this never seem to update.

    Are there any suggestions on what may be going on here and how i can fire the 'Refresh' activity manually?

    Thanks for any help. ~R

  3. christopher koch

    I have tried DocMessageClass with Outlook 2013 and found it worked for me.

    1. Diane Poremsky

      Which suite are you using? 32- or 64-bit? It could be the type of installation (click to run or MSI), bitness, or a recent Outlook update fixed it.

  4. abishek sharma

    Hey Diane is it possible to modify just the global address list window which appears when we click the 'To' button on message window. We have a new requirement where the business wants to add some custom search and sorting functionality in the global address list.

    1. abishek sharma

      Thanks Diane for your prompt reply. So you mean to say it is possible to design a new form and intercept the call from different events. Is it possible to completely replace the from with new form and hence not intercept the call from different events. In the process also replace the address list button on the ribbon of outlook home tab.

  5. Dominik

    hey diane, I wrote a piece of vba code to change the message class of all my contact items in a specific folder to display them in a custom form I've created. The code works fine and correctly but if I open a contact it is still displayed in a form I used before.

Leave a Reply

If the Post Comment button disappears, press your Tab key.

This site uses XenWord.