Activate the code module for your UserForm, and enter the following procedure:
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Prevents use of the Close button
If CloseMode = vbFormControlMenu Then
MsgBox "Clicking the Close button does not work."
Cancel = True
End If
End Sub
When the user clicks the Close button, a message box appears and the UserForm
remains open.