- This issue occurs only when you run the code in quick succession to add a UserProperty object to the same email message the second time.
- This issue does not occur when the preview pane is disabled or if you switch between email messages before you run the code for the second time.
To reproduce this issue, follow these steps:
- Select an email message in the message list.
- Make sure that the preview pane is enabled.
- Run the following code for the same email message two times in quick succession:
Dim oExp As Outlook.Explorer
Dim oSel As Outlook.Selection
Dim oMail As Outlook.MailItem
Dim oProp As UserProperty
Dim oProps As UserProperties
Set oExp = Application.ActiveExplorer
Set oSel = oExp.Selection
For iCount = 1 To oSel.Count
If oSel.Item(iCount).Class = OlObjectClass.olMail Then
Set oMail = oSel.Item(iCount)
Set oProps = oMail.UserProperties
Set oProp = oProps.Add("TextProp", olText, False, 1)
oProp.Value = "Sample Text"
Set oExp = Nothing
Set oSel = Nothing
Set oMail = Nothing
Set oProp = Nothing
Set oProps = Nothing
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Article ID: 3064609 - Last Review: 27 May 2015 - Revision: 1