UserDefinedProperty.Type 属性 (Outlook)

返回一个 OlUserPropertyType 常量,指示 UserDefinedProperty 对象的类型。 只读。

语法

表达式类型

表达 一个代表 UserDefinedProperty 对象的变量。

示例

以下Visual Basic for Applications (VBA) 示例在“即时窗口中显示指定的 Folder 对象的名称,以及指定 Folder 对象的 UserDefinedProperties 集合中包含的每个 UserDefinedProperty 对象的名称和类型。

Sub DisplayUserProperties(ByRef FolderToCheck As Folder) 
 
 Dim objProperty As UserDefinedProperty 
 
 
 
 ' Print the name of the specified Folder object 
 
 ' reference to the Immediate window. 
 
 Debug.Print "--- Folder: " & FolderToCheck.Name 
 
 
 
 ' Check if there are any user-defined properties 
 
 ' associated with the Folder object reference. 
 
 If FolderToCheck.UserDefinedProperties.Count = 0 Then 
 
 ' No user-defined properties are present. 
 
 Debug.Print " No user-defined properties." 
 
 Else 
 
 ' Iterate through every user-defined property in 
 
 ' the folder. 
 
 For Each objProperty In FolderToCheck.UserDefinedProperties 
 
 ' Retrieve the name of the user-defined property. 
 
 strPropertyInfo = objProperty.Name 
 
 ' Retrieve the type of the user-defined property. 
 
 Select Case objProperty.Type 
 
 Case OlUserPropertyType.olCombination 
 
 strPropertyInfo = strPropertyInfo & " (Combination)" 
 
 Case OlUserPropertyType.olCurrency 
 
 strPropertyInfo = strPropertyInfo & " (Currency)" 
 
 Case OlUserPropertyType.olDateTime 
 
 strPropertyInfo = strPropertyInfo & " (Date/Time)" 
 
 Case OlUserPropertyType.olDuration 
 
 strPropertyInfo = strPropertyInfo & " (Duration)" 
 
 Case OlUserPropertyType.olEnumeration 
 
 strPropertyInfo = strPropertyInfo & " (Enumeration)" 
 
 Case OlUserPropertyType.olFormula 
 
 strPropertyInfo = strPropertyInfo & " (Formula)" 
 
 Case OlUserPropertyType.olInteger 
 
 strPropertyInfo = strPropertyInfo & " (Integer)" 
 
 Case OlUserPropertyType.olKeywords 
 
 strPropertyInfo = strPropertyInfo & " (Keywords)" 
 
 Case OlUserPropertyType.olNumber 
 
 strPropertyInfo = strPropertyInfo & " (Number)" 
 
 Case OlUserPropertyType.olOutlookInternal 
 
 strPropertyInfo = strPropertyInfo & " (Outlook Internal)" 
 
 Case OlUserPropertyType.olPercent 
 
 strPropertyInfo = strPropertyInfo & " (Percent)" 
 
 Case OlUserPropertyType.olSmartFrom 
 
 strPropertyInfo = strPropertyInfo & " (Smart From)" 
 
 Case OlUserPropertyType.olText 
 
 strPropertyInfo = strPropertyInfo & " (Text)" 
 
 Case OlUserPropertyType.olYesNo 
 
 strPropertyInfo = strPropertyInfo & " (Yes/No)" 
 
 Case Else 
 
 strPropertyInfo = strPropertyInfo & " (Unknown)" 
 
 End Select 
 
 
 
 ' Print the name and type of the user-defined property 
 
 ' to the Immediate window. 
 
 Debug.Print strPropertyInfo 
 
 Next 
 
 End If 
 
End Sub

另请参阅

UserDefinedProperty 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。