Userform Close Button

RoyinUK2000

Board Regular
Joined
Mar 26, 2002
Messages
79
Is it possible to stop a user shutting a userform with the close button.

Thx
Roy
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Nope. I only know about 9 things, so I get very excited when I think I might be able to help someone. They are as follows:

Message Boxes
Drawing a Userform
Changing the font of your writing
Changing the colour of your writing
Changing the background of your excel page
Saving your workbook
How to write in a cell
How to call the Office Wizard
and
Where to find excel on your start bar

You never know, you might get stumped on one of those one day, but probably only if you take some bad LSD and it makes you lose your memory.

Hold on, I'll try and get the answer for you....
 
Upvote 0
Come on Joe wheres the answer, or are you still busy petting that dog ( are you sure you are not hanging out of it).

Thx
Roy
 
Upvote 0
So you've seen my ex-girlfriend?

The answer is you have to set cancel to true within the userform_queryclose event.

Now go and update your two year old screen name whilst I attempt the kiss of life on a horse. Whoops, wrong end...
 
Upvote 0
Hey Roy, told you I'd get there. Try this little baby:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
Me.Caption = "Click the CommandButton to close Me!"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,849
Messages
6,121,925
Members
449,056
Latest member
denissimo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top