OL98: PropertyChange Event Does Not Run for Some Fields
ID: Q188002
|
The information in this article applies to:
SYMPTOMS
When you use the PropertyChange event in Visual Basic Scripting Edition
(VBScript) to determine when another user has changed the value of either
the Categories or Message field, the event does not run.
NOTE: The Message field is also called the Notes field or, in the object
model of Outlook, the Body property.
CAUSE
Outlook does not run the event for these fields.
WORKAROUND
To programmatically determine when the Categories field changes, you can
create a user-defined field, link the user-defined field to the Categories
field, and then determine when the user-defined field has changed.
NOTE: This approach will not work with the Message field.
Microsoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft Support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
To work around this problem, follow these steps:
- On the File menu, point to New, and click Contact.
- On the Tools menu, click Forms, and then click Design This Form.
- Click the All Fields tab. Click New at the lower-left corner of the
form, type MyCategories as the name of the field, select Formula in the
Type list, and type [Categories] in the
Formula box. Click OK.
- On the Form menu, click View Code. Type the following Visual Basic
Script into the Script Editor, and then close the editor:
Sub Item_CustomPropertyChange(ByVal myPropertyName)
Select Case myPropertyName
Case "MyCategories"
MsgBox "Categories changed!"
Case Else
End Select
End Sub
- Click the P.2 tab of the form. Make sure "User-defined fields in this
folder" is selected in the list at the top of the Field Chooser window
and drag the MyCategories field from the Field Chooser window onto the
form.
This will add the field to the form so the procedure will work
correctly. You can delete these controls that are used to display the
MyCategories field from the P.2 tab and hide the page.
- On the Form menu, click Run This Form.
NOTE: The CustomPropertyChange event will run multiple times.
- Type a value into the Categories field and then click somewhere else in
the form to remove focus from the field. The CustomPropertyEvent will
now run multiple times.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article.
MORE INFORMATION
The Message field is an OLE-based field and the only field that can contain
rich text, attachments, or other data, such as Hypertext Markup Language
(HTML). The Categories field is a Keywords field that is designed to store
multiple values.
When user-defined fields are set to "automatically update" or are defined
as Formula or Combination fields, they will run the CustomPropertyChange
event multiple times. When another field is updated or other circumstances
occur (for example, if the user changes pages on the form), the event is
run. This behavior will vary depending on the type of form being used. The
Contact form will run the event more frequently than other types of forms,
because many of the standard fields on the Contact form are actually
Combination fields, which are calculated based on the values of other
fields. While having the event run multiple times does not affect most of
the CustomPropertyChange event usage, you should expect the code in the
event to run repeatedly.
REFERENCES
For more information about creating solutions with Microsoft Outlook 98,
please see the following articles in the Microsoft Knowledge Base:
Q180826 OL98: Resources for Custom Forms and Programming
Q182349 OL98: Questions About Custom Forms and Outlook Solutions
Additional query words:
OutSol OutSol98 vbscript
Keywords : kbdta OffVBS
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbprb