My Assistant
![]() ![]() |
|
|
Mar 25 2005, 02:53 PM
Post
#1
|
|
|
UtterAccess Addict Posts: 149 |
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 End If End Sub |
|
|
|
Mar 25 2005, 03:04 PM
Post
#2
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hi Randy,
showing the form as modal, Userform1.Show vbModal could help. Martin |
|
|
|
Mar 25 2005, 03:14 PM
Post
#3
|
|
|
UtterAccess Addict Posts: 149 |
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
Post
#4
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
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... Martin |
|
|
|
Mar 25 2005, 10:35 PM
Post
#5
|
|
|
UtterAccess Addict Posts: 149 |
That was just what I was trying to do (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Thanks again |
|
|
|
Mar 26 2005, 05:40 PM
Post
#6
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Glad to help,
you're welcome (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) Martin |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 21st May 2013 - 07:02 PM |