WD97: How to Disable Word Title Bar Close Command and ButtonID: Q192733
|
In Microsoft Word 97 for Windows, there is no built-in functionality for making commands unavailable on the Title Bar Control menus. This article provides a macro you can use to selectively disable some or all of these commands on the Word 97 for Windows application title bar.
Microsoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/
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
Additional query words: vba api commandbars toolbar controls
Keywords : kbwordvba
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 8, 1999