View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default close file disable toolbar

From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub


Insert a module and copy the below macro..which is to be assigned to a button

Sub CloseBook()
ThisWorkbook.Close True
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Alberto Ast" wrote:

Is there a way to force user to close file with a buttom macro and disable
the regualr closing opcions like close, exit and X at top right corner?