Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default The userform X button

Hi

Is it possible to disable the close button (the "X") on a userform? And
how?


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default The userform X button

In the userform's UserForm_QueryClose event set Cancel to 1:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then Cancel = 1 ''0 = "x" clicked. 1 = Unload Me
End Sub

Private Sub CommandButton1_Click()
Unload Me
End Sub


--
Jim Rech
Excel MVP
"Esben " wrote in message
...
| Hi
|
| Is it possible to disable the close button (the "X") on a userform? And
| how?
|
|
| ---
| Message posted from http://www.ExcelForum.com/
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default The userform X button

have a look in the object browser for vbQueryClos

theses are the values for closemode in
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer

Const vbFormControlMenu = 0 ' this is if u close the form by clicking the "X" butto
Const vbFormCode = 1 ' u want to close it from somewhere in the code u have writte
Const vbAppWindows = 2 ' if windows is closing the applicatio
Const vbAppTaskManager = 3 ' u closed the application from teh task manage
Const vbFormMDIForm =


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW to close a userform using a button CC Excel Discussion (Misc queries) 2 October 10th 08 02:06 PM
Userform + close button Chip Smith Excel Discussion (Misc queries) 2 April 1st 06 09:35 AM
Use the X button on a userform Greg B Excel Discussion (Misc queries) 3 May 16th 05 09:19 AM
Userform Close button Juan Excel Programming 5 May 6th 04 10:15 PM
UserForm Button Help meflorence Excel Programming 2 March 2nd 04 05:35 PM


All times are GMT +1. The time now is 02:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"