当指定的 Microsoft Office Web 组件确定是否启用指定的命令时,该事件发生。
Private Sub Form_CommandEnabled(ByVal Command As Variant, ByVal Enabled As Object)
Command 经确认已启用的命令。
Enabled 将该对象的 Value 属性设为 False,会禁用该命令。
OCCommandId、ChartCommandIdEnum 和 PivotCommandId 常量包含每个 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