View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Userform close button

As a user, I'm accustomed to using that X to close the form. Why make it more
difficult for me? Your userform could call the commandbutton_click procedure
associated with the Exit button.

Option Explicit
Private Sub CommandButton2_Click()
'clean up whatever you need to here.
Unload Me
End Sub
Private Sub Userform_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Call CommandButton2_Click
End If
End Sub



AOU wrote:

Is there a way to disable the close button top right of a userform. I am
after the user only being able to use a commandbutton titled 'Exit'
--
AOU


--

Dave Peterson