【发布时间】:2013-06-23 08:00:42
【问题描述】:
当我选中复选框以取消选中复选框时,我试图在弹出的消息框中获取取消按钮。我已经弹出框,但我的取消按钮产生“运行时错误 438”。
我目前的代码如下:
Sub Checkbox1()
Dim msgRes As VbMsgBoxResult
msgRes = MsgBox("Please review your changes. If correct, click OK", _
vbOKCancel)
If msgRes = vbCancel Then
Sheets("sheet1").Checkbox1.Value = False
End If
End Sub
【问题讨论】:
-
如果我删除 Sheets("sheet1").Checkbox1.Value = False 此行代码可以正常工作。究竟是什么问题,在哪一行?
-
我手头没有 vba 编辑器,但有没有可能,你必须写
Sheets("Sheet1").Checkbox1.Value = False? “sheet1”和“Sheet1”不应相同。