我有这个工作簿,我想让它看起来像一个程序。 我也希望使用它的人只能通过特定的命令按钮退出应用程序。仅通过VBA关闭应用程序
这里是我的代码有
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "{ESC}"
Cancel = True
MsgBox "Please use the QUIT button to save and close the database."
End Sub
而对于退出按钮:
Sub SAVE_CLOSE
ActiveWorkbook.Save
If Workbooks.Count < 2 Then
Application.Quit
Else
ActiveWorkbook.Close
End If
End Sub
我的问题是,当用户退出通过这个按钮的应用程序,它触发私人小组Workbook_BeforeClose事件并取消退出过程。你会如何解决这个问题?
谢谢!
哦,嘿,我正在打字,但有例子!尼斯。 :) – steegness
工作就像一个魅力!谢谢! – Alex