VBOffice

Assign a Form to an Item

Tell Outlook to use your custom form instead of the default form to display an item.

Last modified: 2009/09/23 | Accessed: 70.609  | #75
◀ Previous sample Next sample ▶
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.

Outlook decides by the value of an item's MessageClass property which form to use to display the item. As that value is stored for each item, it is not sufficient just to assign a new form to a folder. Because old items would still display with the old form.

With the following macro you can update the property for all items in the current folder. For that you need to enter the name of the new form. For instance, the name of the default form for emails is 'IPM.Note'; the name of your form then could be 'IPM.Note.MyForm'.

After you have copied the macro to the module 'ThisOutlookSession' in the VBA editor, you can call it by pressing alt+f8.


tip  How to add macros to Outlook
Public Sub ChangeMessageClassForFolderItems()
  Dim Items As Outlook.Items
  Dim obj As Object
  Dim OldClass$
  Dim NewClass$
  Dim i&

  Set Items = Application.ActiveExplorer.CurrentFolder.Items
  If Items.Count > 1 Then
    OldClass = Items(1).MessageClass
    NewClass = InputBox("Change MessageClass property of all items to: " _
      , "Change MessageClass", OldClass)
    If NewClass = "" Or LCase$(NewClass) = LCase$(OldClass) Then
      Exit Sub
    End If
    For i = 1 To Items.Count
      Set obj = Items(i)
      obj.MessageClass = NewClass
      obj.Save
    Next
  End If
End Sub
SAM SAM
Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules.
email  Send a message