Okay for the Max and Min I got
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) _
As Long
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
Sub HideMinimizeAndMaximizeButtons()
Dim L As Long
L = GetWindowLong(Application.hwnd, GWL_STYLE)
L = L And Not (WS_MINIMIZEBOX)
L = L And Not (WS_MAXIMIZEBOX)
L = SetWindowLong(Application.hwnd, GWL_STYLE, L)
End Sub
Sub RestoreMinimizeAndMaximizeButtons()
Dim L As Long
L = GetWindowLong(Application.hwnd, GWL_STYLE)
L = SetWindowLong(Application.hwnd, GWL_STYLE, WS_MINIMIZEBOX _
Or WS_MAXIMIZEBOX Or L)
End Sub
Which works
HOWEVER FOR CLOSE BUTTON I HAVE
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
WHICH I GOT
=
CLICK
THE PROBLEM IS I DONT KNOW HOW TO RESTORE THE CLOSE.
TY