retiredrhb
New Member
- Joined
- Feb 15, 2003
- Messages
- 4
The following code, posted by Raider, successfully disables the famous (X) close button at the top right corner of the Excel window. What changes to this code would I make to disable the Minimize or Maximize buttons at the top right corner of the Excel 2000 Window?
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Workbook_Open()
Dim MyHandle
Dim hWnd As Long
MyCap$ = Application.Caption
hWnd = FindWindowA(vbNullString, MyCap$)
MyHandle = GetSystemMenu(hWnd, 0)
Call RemoveMenu(MyHandle, 6, &H400)
End Sub
This message was edited by retiredrhb on 2003-02-16 17:01
This message was edited by retiredrhb on 2003-02-16 17:03
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Workbook_Open()
Dim MyHandle
Dim hWnd As Long
MyCap$ = Application.Caption
hWnd = FindWindowA(vbNullString, MyCap$)
MyHandle = GetSystemMenu(hWnd, 0)
Call RemoveMenu(MyHandle, 6, &H400)
End Sub
This message was edited by retiredrhb on 2003-02-16 17:01
This message was edited by retiredrhb on 2003-02-16 17:03