當指定的 Microsoft Office Web 元件判斷是否啟用指定的命令時,就會發生。
語法
表達。CommandEnabled (命令,已啟用)
expression 代表 Form 物件的變數。
參數
| 名稱 | 必要/選用 | 資料類型 | 描述 |
|---|---|---|---|
| Command | 必要 | Variant | 已經驗證為已啟動的命令。 |
| Enabled | 必要 | Object | 此物件的 Value 屬性設 為 False 以停用命令。 |
傳回值
無
註解
OCCommandId、ChartCommandIdEnum 和 PivotCommandId 常數包含每個 Microsoft Office Web 元件支援的命令清單。
範例
下列範例示範擷取 CommandEnabled 事件的副程式的語法。
Private Sub Form_CommandEnabled( _
ByVal Command As Variant, ByVal Enabled As Object) Dim intResponse As Integer
Dim strPrompt As String
strPrompt = "Disable the command?"
intResponse = MsgBox(strPrompt, vbYesNo)
If intResponse = vbYes Then
Enabled.Value = False
Else
Enabled.Value = True
End If
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。