View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dan E[_2_] Dan E[_2_] is offline
external usenet poster
 
Posts: 102
Default SIMPLEST way to disable "close" button on form?

Put this in the code window for the form's you want close disabled on

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox Prompt:= "Close disabled"
End If
End Sub

Disable double clicking (form only not controls)
Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = True
MsgBox Prompt:="Double click disabled"
End Sub


Dan E

"codytheretriever" wrote in message ...
Have 10 forms in an Excel based
project. On eight of the forms
I need to disable "close" button
and double-click capability so
that user must only go in directions
allowed by form command buttons.
On the other two forms using "close"
or double-click is ok. Have tried
all of the Knowledge Base suggestions
but keep getting compile errors for
"ambiguous ... blah ... blah ... blah",
NOT due to typing errors! Could someone
give me SIMPLE directions on how to
disable "close" button on a form by
form basis? Hope someone can help,
and thanks in advance if you can.