These two macros enable and disable the Exit button from the File menu and the close X in the top right hand corner. They're not the most simple of macros as they use API calls but they should do what you want.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Const SC_CLOSE As Long = &HF060
Sub DisableExits()
Dim Combar As CommandBar, Cont As CommandBarControl
Dim lButtonIndex As Long, lXLHandle As Long, lSysMenu As Long
Set Combar = CommandBars("File")
For Each Cont In Combar.Controls
If Cont.Caption = "E&xit" Then
lButtonIndex = Cont.Index
Exit For
End If
Next
If lButtonIndex = 0 Then Exit Sub 'An error has occurred
Combar.Controls(lButtonIndex).Enabled = False
lXLHandle = FindWindow("XLMAIN", Application.Caption)
lSysMenu = GetSystemMenu(lXLHandle, 0)
DeleteMenu lSysMenu, SC_CLOSE, 0&
End Sub
Sub EnableExits()
Dim Combar As CommandBar, Cont As CommandBarControl
Dim lButtonIndex As Long
Set Combar = CommandBars("File")
For Each Cont In Combar.Controls
If Cont.Caption = "E&xit" Then
lButtonIndex = Cont.Index
Exit For
End If
Next
Combar.Controls(lButtonIndex).Enabled = True
lXLHandle = FindWindow("XLMAIN", Application.Caption)
lSysMenu = GetSystemMenu(lXLHandle, 1)
End Sub
HTH,
Dax.