View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_8_] Nigel[_8_] is offline
external usenet poster
 
Posts: 172
Default Disabling Excel X Application Button

Thanks Bob.

Any ideas about converting it for use in Outlook?

Cheers
Nigel

"Bob Phillips" wrote in message
...
It should work okay in XL97 as long as you note the comment that I made.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Nigel" wrote in message
...
Thanks Michel, this works in my Excel 2002 environment, do you know if

it
will in Excel97 ?
I do not understand all the intricacies of the subsequent hWnd debate.

Also will this work in Outlook (2002 and 98) ?

Cheers
Nigel

"Michel Pierron" wrote in message
...
Hi Nigel;
Try this (in ThisWorkbook module):

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 Application.hWnd
End Sub

Private Sub Workbook_Open()
hWnd = FindWindow(vbNullString, Application.Caption)
End Sub

MP

"Nigel" a écrit dans le message de
...
Hi All
Is there a way of disabling the Windows X - application close

button -
after
opening Excel. I know I can do this with a userform but not the

application
as a whole.

Thanks

Nigel