MrExcel Publishing
Your One Stop for Excel Tips & Solutions

exit button on forms


Posted by Blake Rubin on February 13, 2002 6:53 AM

how do i take the exit button, that is by default at the top right corner of the form, off the form so you can not exit with it? disabling would be fine also, thanks.


Posted by Jim on February 13, 2002 7:42 AM

Hi Blake,

Heres one way, credit: J-Walk

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
MsgBox "You can't close the form like that"
Cancel = True
End If
End Sub

Jim