ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to desensitize the "X" on Inputboxs, Textboxes and other gui's (https://www.excelbanter.com/excel-programming/413271-how-desensitize-x-inputboxs-textboxes-other-guis.html)

[email protected]

How to desensitize the "X" on Inputboxs, Textboxes and other gui's
 
Good morning!

I find myself without my VBA bible, it is at work and I am at
home....in it was a method to desenitize the "X" found on various
boxes that can be build via VBA. To my horror I have found several
field type people (read that as users) who are using this 'X' and
blowing up my VBA utility.

Can some one offer the fix for this that I can't quite remember and
put me out of my misery?

Thanks

Wayne

Alan

How to desensitize the "X" on Inputboxs, Textboxes and other gui's
 
This might be too late for you, but here is code to stop the user from
closing with the "X". This is for a userform; you didn't mention if that was
the case or not.

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the OK button." 'Change message to suite.
End If
End Sub


Alan



" wrote:

Good morning!

I find myself without my VBA bible, it is at work and I am at
home....in it was a method to desenitize the "X" found on various
boxes that can be build via VBA. To my horror I have found several
field type people (read that as users) who are using this 'X' and
blowing up my VBA utility.

Can some one offer the fix for this that I can't quite remember and
put me out of my misery?

Thanks

Wayne


Jon Peltier

How to desensitize the "X" on Inputboxs, Textboxes and other gui's
 
Maybe you've never thought of it, but this is a bad way to disable the red
X. Why chastise your user for using the red X to dismiss the form?

The technique I posted, and the approach Rick mentioned, both cause the red
X click to actually execute a click on the button you want the user to press
to dismiss the dialog.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Alan" wrote in message
...
This might be too late for you, but here is code to stop the user from
closing with the "X". This is for a userform; you didn't mention if that
was
the case or not.

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the OK button." 'Change message to suite.
End If
End Sub


Alan



" wrote:

Good morning!

I find myself without my VBA bible, it is at work and I am at
home....in it was a method to desenitize the "X" found on various
boxes that can be build via VBA. To my horror I have found several
field type people (read that as users) who are using this 'X' and
blowing up my VBA utility.

Can some one offer the fix for this that I can't quite remember and
put me out of my misery?

Thanks

Wayne





All times are GMT +1. The time now is 02:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com