Article ID: 192733
Article Last Modified on 1/23/2007
Declare Function FindWindowA Lib "user32" (ByVal lpClassName$, _
ByVal lpWindowName As Long) As Long
Declare Function GetFocus Lib "user32" () As Long
Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _
ByVal nPosition As Long, ByVal wFlags As Long) As Long
Sub RemoveItem()
Dim hwnd, hMnu, y
Const MF_BYPOSITION As Long = 1024
Const MF_GRAYED As Long = 1
Const MF_DISABLED As Long = 2
hwnd = FindWindowA("OPUSApp", 0)
hMnu = GetSystemMenu(hwnd, 0)
For I = 6 To 0 Step -1
y = RemoveMenu(hMnu, I, MF_BYPOSITION)
Next I
End Sub
173707 OFF97: How to Run Sample Code from Knowledge Base Articles
Additional query words: vba api commandbars toolbar controls
Keywords: kbfaq kbhowto KB192733