View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Disabling the Red X in Excel

Just a curiosity question...

Why do you want to stop the user from using the X button? If there's some code
in the Cancel button that needs to be run, couldn't your userform_queryclose
procedure call that cancel button's procedure?



beginner here wrote:

I'm trying to find the coding to disable the red 'X' in the right hand corner
of any Excel worksheet. I know what the code is for a form, but can't find
the code for the worksheet.

The code I'm using for my form is the following:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button !!"
End If
End Sub

Any help would be appreciated.

Steve


--

Dave Peterson