Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Dear Friends, I have a userform, & I put the below procedure to prevent form by pressing X on the top right side button. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = True End Sub But when I use Control + PauseBrake button its closing. which I dont want. may be any user knows this technique, then he can close the form. Pls if any one knows how to prevent to run the Ctrl+Brake button to close the form like this. Thanks and regards. Shahzad |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the form's Intialize or Activate event you could include
Application.EnableCancelKey = xlDisabled and in the QueryClose event at the end If not Cancel then Application.EnableCancelKey = xlErrorHandler Read more about EnableCancelKey and it's typical use of temporarily changing to xlErrorHandler, to give trappable error code 9 in the error handler to give user a chance to abort some long routine, perhaps after a confirmation message. In general it's not considered user friendly not to allow some way of exiting a form with say a Cancel button or the little X. If you have some sort of a cancel button it's worth setting its Cancel property to True, so the little X will trigger the its click event. Regards, Peter T "Shazi" wrote in message ... Dear Friends, I have a userform, & I put the below procedure to prevent form by pressing X on the top right side button. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = True End Sub But when I use Control + PauseBrake button its closing. which I dont want. may be any user knows this technique, then he can close the form. Pls if any one knows how to prevent to run the Ctrl+Brake button to close the form like this. Thanks and regards. Shahzad |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jul 17, 2:54*pm, "Peter T" <peter_t@discussions wrote:
In the form's Intialize or Activate event you could include Application.EnableCancelKey = xlDisabled and in the QueryClose event at the end If not Cancel then Application.EnableCancelKey = xlErrorHandler Read more about EnableCancelKey and it's typical use of temporarily changing to xlErrorHandler, to give trappable error code 9 in the error handler to give user a chance to abort some long routine, perhaps after a confirmation message. In general it's not considered user friendly not to allow some way of exiting a form with say a Cancel button or the little X. *If you have some sort of a cancel button it's worth setting its Cancel property to True, so the little X will trigger the its click event. Regards, Peter T "Shazi" wrote in message ... Dear Friends, I have a userform, & I put the below procedure to prevent form by pressing X on the top right side button. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = True End Sub But when *I *use Control + PauseBrake * button *its closing. which I dont want. *may be any user knows this technique, then he can close the form. Pls if any one knows how to prevent to run the Ctrl+Brake button to close the form like this. Thanks and regards. Shahzad- Hide quoted text - - Show quoted text - Hi, Mr. Peter, I applied your code in my UserForm, and its not closing as per my requirement. you solved my problem, thank you very much for your support and taking time for me. Thanks a lot. Regards. Shahzad |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
unload userform | Excel Programming | |||
Unload a Userform created in VB6 | Excel Programming | |||
Show/Unload Userform | Excel Programming | |||
unload userform problem | Excel Programming | |||
load/unload userform | Excel Programming |