共用方式為


OutlookBarShortcuts.BeforeShortcutRemove 事件 (Outlook)

會在從 [快捷方式] 窗格中的群組中移除新的 快捷 方式之前發生,可能是因為使用者動作或程式碼所造成。

語法

expressionBeforeShortcutRemove( _Shortcut_ , _Cancel_ )

表達 代表 OutlookBarShortcuts 物件的 變數。

參數

名稱 必要/選用 資料類型 描述
Shortcut 必要 OutlookBarShortcut 正在移除的 OutlookBarShortcut
Cancel 必要 布林值 False 事件發生時。 如果事件程序將此引數設定為 True,則不會從群組移除捷徑。

註解

Microsoft Visual Basic Scripting Edition (VBScript) 中沒有這個事件。

範例

下列 Microsoft Visual Basic for Applications (VBA) 範例會防止使用者從 [快捷方式 ] 窗格中移除快捷方式。 範例程式碼必須放在類別模組中,而且 Initialize_handler 必須先呼叫常式,Microsoft Outlook 才能呼叫事件程序。

Dim WithEvents myOlShortcuts As Outlook.OutlookBarShortcuts 
Dim myOlBar As Outlook.OutlookBarPane 
 
Sub Initialize_handler() 
 Set myOlBar = Application.ActiveExplorer.Panes.Item("OutlookBar") 
 Set myOlShortcuts = myOlBar.Contents.Groups.Item(1).Shortcuts 
End Sub 
 
Private Sub myOlShortcuts_BeforeShortcutRemove(ByVal Shortcut As OutlookBarShortcut, Cancel As Boolean) 
 MsgBox "You are not allowed to remove a shortcut from this group." 
 Cancel = True 
End Sub

另請參閱

OutlookBarShortcuts 物件

支援和意見反應

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