View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
pano pano is offline
external usenet poster
 
Posts: 84
Default Disable X button on excel

On Mar 27, 5:08 pm, "Haldun Alay" wrote:
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- Hide quoted text -


- Show quoted text -


Hmm Haldun, this sure does stop the user pressing the X button but I
need it to close the workbook which it does but also close excel down

thanks for the help so far
stephen