UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Cancel all closes except with user forms button close    
 
   
randyzapata
post 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
Go to the top of the page
 
+
KingMartin
post 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
Go to the top of the page
 
+
randyzapata
post 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
Go to the top of the page
 
+
KingMartin
post 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
Go to the top of the page
 
+
randyzapata
post 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
Go to the top of the page
 
+
KingMartin
post 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 the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 07:02 PM