How do I disable the workbook close method

  • Thread starter Thread starter Jenny
  • Start date Start date
J

Jenny

If I have multiple workbooks open, how can I
programmatically prevent the users from using the close
button (or file option) to close the workbook? I need
that all to be done through my code.

Is this possible?

~Jenny
 
Private Sub Workbook_BeforeClose(Cancel As Boolean)

If Not MyClose Then
Cancel = True
Endif

End Sub

The myClose variable should be a global Boolean, which you set to True in
your code.

This code goes in the Thisworkbook code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top