View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Disabling Excel X Application Button

Nigel,

The code as it stands works on a workbook activate. So switching between
workbooks turns it on and off. Do you want it for everything in Outlook?

--

HTH

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

"Nigel" wrote in message
...
Hi Bob
I thought it might be possbile to include in the Outlook

Application_Startup
event, stored as part of ThisOutlookSession project code?
I did try it but it did not work in its current form. I am not sure if

this
code runs when Outlook opens or if it does it needs to be ordered
differently.

Cheers
Nigel

"Bob Phillips" wrote in message
...
Nigel,

It currently is triggered when a particular workbook is activated. What
would be the Outlook trigger, that is what so you want to tie it to, and
when would it be invoked?

--

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 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