Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I wish to prevent users from closing the active excel window with the window close button (x). I would like them to use a macro-linked button for that. Is there a way to code this into VBA such that the (x)-button is disabled? Thanks Sal |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following was supplied courtesy of Michel Pierron, you need to put it in
the workbook code. It works for me in Excel2002. Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) Private Declare Function GetSystemMenu& Lib "user32" _ (ByVal hWnd As Long, ByVal bRevert As Long) Private Declare Function DeleteMenu& Lib "user32" (ByVal hMenu As Long _ , ByVal nPosition As Long, ByVal wFlags As Long) Private Declare Function DrawMenuBar& Lib "user32" (ByVal hWnd As Long) Private hWnd& Private Sub Workbook_Activate() DeleteMenu GetSystemMenu(hWnd, 0), &HF060, 0& DrawMenuBar hWnd End Sub Private Sub Workbook_Deactivate() GetSystemMenu hWnd, True DrawMenuBar hWnd End Sub Private Sub Workbook_Open() hWnd = FindWindow(vbNullString, Application.Caption) End Sub "cyclingsal" wrote in message om... Hi, I wish to prevent users from closing the active excel window with the window close button (x). I would like them to use a macro-linked button for that. Is there a way to code this into VBA such that the (x)-button is disabled? Thanks Sal |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Nigel
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
missing Active Window bar | New Users to Excel | |||
Preventing scroll outside active area | Excel Discussion (Misc queries) | |||
Unexpected closure of Excel | Links and Linking in Excel | |||
Active Window Question | Excel Discussion (Misc queries) | |||
Changing Excel Icon in the Active Window | Excel Programming |