Mar 25 2005, 02:53 PM
I am using the following to prevent a user from closing a form but I also want prevent a user from saving or closing excel except if they use my user form buttons. Is this possible?
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Application.DisplayAlerts = True
MsgBox "Sorry, you may not close the form like that!"
Cancel = True
Application.DisplayAlerts = False
Mar 25 2005, 03:04 PM
showing the form as modal,
Mar 25 2005, 03:14 PM
but how do I disable the user from saving or closing excel when I close or hide the user form
Mar 25 2005, 04:10 PM
You'll need API calls for true disabling of the close button in the application menu.
I attached an example of a pure VBA approach, see if it helps...
Mar 25 2005, 10:35 PM
That was just what I was trying to do
Mar 26 2005, 05:40 PM
Glad to help,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here