disable the red "x" @ top right coner

P

pswanie

how (if posible) can i disable the red cross at the top right hand coner to
prevent ppl closing the workbook that way?
 
V

Vasant Nanavati

Are you talking about closing the workbook or closing the Excel application?
_________________________________________________________________________
 
P

pswanie

i want to prevent ppl closing the workbook with the "X"

i got a button with a macro that saves, print and quit the workbook.

thanx
 
V

Vasant Nanavati

There are two Xs, one for the workbook window and one for the application
window.

In any event:

In the ThisWorkbook module:

Public fMacro As Boolean

Private Sub Workbook_BeforeClose()
If Not fMacro Then Cancel = True
End Sub

In your macro which closes the workbook:

'Your code except for the close
ThisWorkbook.fMacro = True
'Code to close
__________________________________________________________________________
 
V

Vasant Nanavati

I don't know that I would mess with system menus except as a last resort,
unless I was constructing a dictator app.
_________________________________________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top