共用方式為


Outlook) (Category.ShortcutKey 屬性

會傳回或設定 OlCategoryShortcutKey 常數,指定 Category 物件所使用的快速鍵。 讀取/寫入。

語法

運算式ShortcutKey

表達 代表 Category 物件的變數。

註解

olCategoryShortcutKeyNone 以外的任何 OlCategoryShortcutKey 常數無論何時都只能由一個 Category 物件使用。 若將此屬性的值設定為已使用的 OlCategoryShortcutKey 常數,則會將使用所指定值之 Category 物件的 ShortcutKey 屬性設定為 olCategoryShortcutKeyNone

範例

下列的 Visual Basic for Applications (VBA) 範例針對包含在與預設的 NameSpace 物件相關聯之 Categories 集合所包的每個 Category 物件,顯示包含其快速鍵指定的對話方塊。

Private Sub ListShortcutKeys() 
 
 Dim objNameSpace As NameSpace 
 
 Dim objCategory As Category 
 
 Dim strOutput As String 
 
 
 
 ' Obtain a NameSpace object reference. 
 
 Set objNameSpace = Application.GetNamespace("MAPI") 
 
 
 
 ' Check if the Categories collection for the Namespace 
 
 ' contains one or more Category objects. 
 
 If objNameSpace.Categories.Count > 0 Then 
 
 
 
 ' Enumerate the Categories collection, checking 
 
 ' the value of the ShortcutKey property for 
 
 ' each Category object. 
 
 For Each objCategory In objNameSpace.Categories 
 
 
 
 ' Add the name of the Category object to 
 
 ' the output string. 
 
 strOutput = strOutput & objCategory.Name 
 
 
 
 ' Add information about the assigned shortcut key 
 
 ' to the output string. 
 
 Select Case objCategory.ShortcutKey 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyNone 
 
 strOutput = strOutput & ": No shortcut key" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF2 
 
 strOutput = strOutput & ": Ctrl+F2" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF3 
 
 strOutput = strOutput & ": Ctrl+F3" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF4 
 
 strOutput = strOutput & ": Ctrl+F4" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF5 
 
 strOutput = strOutput & ": Ctrl+F5" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF6 
 
 strOutput = strOutput & ": Ctrl+F6" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF7 
 
 strOutput = strOutput & ": Ctrl+F7" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF8 
 
 strOutput = strOutput & ": Ctrl+F8" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF9 
 
 strOutput = strOutput & ": Ctrl+F9" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF10 
 
 strOutput = strOutput & ": Ctrl+F10" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF11 
 
 strOutput = strOutput & ": Ctrl+F11" & vbCrLf 
 
 Case OlCategoryShortcutKey.olCategoryShortcutKeyCtrlF12 
 
 strOutput = strOutput & ": Ctrl+F12" & vbCrLf 
 
 Case Else 
 
 strOutput = strOutput & ": Unknown" & vbCrLf 
 
 End Select 
 
 Next 
 
 End If 
 
 
 
 ' Display the output string. 
 
 MsgBox strOutput 
 
 
 
 ' Clean up. 
 
 Set objCategory = Nothing 
 
 Set objNameSpace = Nothing 
 
 
 
End Sub

另請參閱

Category 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應