LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Disabling Excel X Application Button

Hi Bob;
You are right Bob; the explanation was given by Rob.
Application.Hwnd is only for the lucky.
:-) MP

"Bob Phillips" a écrit dans le message de
...
Michael,

Small error. In Workbook_Deactivate it should be

DrawMenuBar hWnd

--

HTH

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

"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










 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
disabling a command button Paul James[_3_] Excel Programming 16 February 18th 04 07:10 AM
Disabling the minimise button in Excel workbook David Excel Programming 5 November 26th 03 12:08 PM
disabling cells based on cmd button Consuelo Excel Programming 1 September 20th 03 09:44 AM
Disabling font color button Michael Singmin Excel Programming 1 September 16th 03 10:32 PM


All times are GMT +1. The time now is 01:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"