Visual Basic Technique
Basically you have 2 .OFT files:
1. Special.oft - a special screen design - for example
ChangeMessageClass.oft - to apply the special screen file above
in to a folder such as "C:\Program Files\Microsoft Office\Templates\Outlook"
and run it.
1. Disable Macros - to edit the Change
This Edits an existing VBScript Code
Tools, Forms, Design This Form - takes you to the design mode
Form, View Code - allowsyou to change the Visual Basic Code
File, Save As... make a new, or over-write the previous OFT file
2. Enable Macros - to run the Change
Enable Macros This applies the form to all the records in the Outlook
Create a New Item to Store the VBScript Code
- On the File menu, point to New, and then
click Mail Message.
- On the Tools menu, point to Forms, and
then click Design This Form to enter form design mode.
Enter the VBScript Code and Save the Form
- On the Form menu, click View Code.
- In the Script Editor, type the following code. You do not need to enter
the lines that begin with an apostrophe, since these lines are comments that
are ignored when executed.
Dim NewMC As String
Dim CurFolder As Outlook.MAPIFolder
Dim CurItem As Outlook.ContactItem
Dim I As Integer
Set CurFolder =
Set AllItems = CurFolder.Items
' Change the following line to your new Message Class
NewMC = "IPM.Contact.MyNewForm"
NumItems = CurFolder.Items.Count
' Loop through all of the items in the folder
For I = 1 to NumItems
Set CurItem = AllItems.Item(I)
' Test to see if the Message Class needs to be
If CurItem.MessageClass <> NewMC Then
' Change the Message Class
CurItem.MessageClass = NewMC
' Save the changed item
- On the File menu, click Close.
- On the File menu, click Save As. Make
sure the default setting for file type is Outlook Template (.oft),
and then select a location to save the file. Enter a file name for the form
and then click OK.
- Close the item by clicking the X in the upper-right
corner of the item window and then click No when prompted to
Run the VBScript Code
- Open the folder that contains the items you wish to update.
- To run the VBScript code, open the item again by using Windows Explorer to
locate the file and then double-click the .oft file. The code will run
automatically because it was entered into an Item_Open event
procedure. If you receive a macro warning, click Enable Macros.
- Wait while the code changes the message class for all of the items in the
currently selected folder. Depending on the number of items, this may take
several minutes. When the code finishes, you should receive a message that
NOTE: If you wish to edit the VBScript code later to change
the name of the message class, hold down the SHIFT key when you open the item.
This prevents the VBScript code from executing and you can go into design mode,
make changes to the VBScript code, and save the form.