Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing the Close (X) button from UserForms 1

Status
Not open for further replies.

mlohmac

MIS
Oct 28, 2002
10
0
0
Hello All,

I have a seemingly simple question for you that I could not readily find in any other posts. I am using Excel 2000 and I am trying to remove the Close button (X) that appears at the top of UserForms. The reason being that I want to force the user to click an Exit command button that will execute some code.

In Access and VB you can customize the control buttons on a form. Is there any way to do this in Excel? Or If I cannot remove the button is there a way I can have it execute some code?

Thanks,
New to Excel and Frustrated
Mlohmac
 
Use the userform_queryclose event to catch the close button click.
Rob
[flowerface]
 
Mlomhac,

Following up on Rob's reply: John Walkenbach has some code to do this on his website. Here is the url to this example

Alternatively, Stephen Bullen, another Excel MVP, has a demo workbook that you can download showing how to actually remove the X close button, using the Win32 API.


HTH
Mike
 
Thanks so much, that event is not as clearly identified as one would like. Works great however. By your reply I take it there is no way to remove the default close button?

-Mlohmac
 
Disregard my previous post, I had not read the rmikesmith's reply. Tahks again everyone.

-Mlohmac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top