我有这个代码禁用excel的close [x]功能。完成输入ID后,我需要再次启用按钮。
我有这个部分禁用[x],
Public FlagToClose As Boolean
Sub Enter_1()
FlagToClose = False
'code
'.....................
FlagToClose = True
End Sub
对于workbook
模块,我有这个,
Private Sub Workbook_Open()
FlagToClose = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not FlagToClose Then Cancel = True
End Sub
那么如何再次启用关闭[x]函数?
答案 0 :(得分:0)
要重新启用关闭,请在关闭之前运行此短宏:
Sub ev_off()
Application.EnableEvents = False
End Sub