共用方式為


Outlook (UserDefinedProperty.Type 屬性)

回傳一個 OlUserPropertyType 常數,表示 UserDefinedProperty 物件的型別。 唯讀。

語法

表情

一個代表 UserDefinedProperty 物件的變數。

範例

以下 Visual Basic for Applications (VBA) 範例,會顯示指定資料夾物件的名稱,以及該資料夾物件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 支援與意見反應