View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
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/
|