View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Haldun Alay Haldun Alay is offline
external usenet poster
 
Posts: 20
Default Disable X button on excel

You can use Workbook_BeforeClose event to force user to close workbook by
pressing a button.

Copy following code to ThisWorkBook code section

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = Not Ok2Close
End Sub

Copy following code to a module

Public Ok2Close As Boolean
Sub CloseMacro()
Ok2Close = True
ThisWorkbook.Close
Ok2Close = False
End Sub

Haldun Alay


"pano" , haber iletisinde sunlari
roups.com...
Is there anyway you can disable the exit button X in excel 2003 as I
only want the users to close and save the workbook thru a button macro
on the worksheet???

Thanks