Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Disable UserForm 'X' Close Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dimm - 25 Mar 2008 02:45 GMT
Hi again,

I hope everyone is keeping well.

I'm wondering if there is any way to disable or remove the X button on the
top right of a UserForm?
Mike - 25 Mar 2008 03:58 GMT
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
Exit Sub
End If
End Sub

> Hi again,
>
> I hope everyone is keeping well.
>
> I'm wondering if there is any way to disable or remove the X button on the
> top right of a UserForm?
Jon Peltier - 25 Mar 2008 04:26 GMT
Instead of just canceling, why not have it run the code in your cancel
button. That's why the user clicked the X anyway, right?

Assuming the cancel button is named btnCancel:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
   If CloseMode = vbFormControlMenu Then
       Cancel = True
       btnCancel
   End If
End Sub

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

> Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
> If CloseMode = vbFormControlMenu Then
[quoted text clipped - 10 lines]
>> the
>> top right of a UserForm?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.