|
|
|
date: Mon, 12 Nov 2007 09:49:22 -0000,
group: microsoft.public.word.vba.customization
back
Disable close button on Word 2007
Hi
I am using the following vba code to disable the close button of
MSWord. It works fine in all previous version of word but does not
work for word 2007.
Any ideas how to disable the close button of word 2007.
Thanks in advance.
Public Declare Function FindWindow Lib "User32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As
Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu 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 ModifyMenu Lib "User32" Alias
"ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal
wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) As
Long
Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long)
As Long
Private Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&
Private Sub DesactiveX()
'désactiver croix de fermeture
On Error Resume Next
Dim Handle As Long
Dim hMenu As Long
Dim nCount As Long
Handle = FindWindow("OpusApp", vbNullString)
hMenu = GetSystemMenu(Handle, 0)
nCount = GetMenuItemCount(hMenu)
Call RemoveMenu(hMenu, nCount - 1, MF_REMOVE Or MF_BYPOSITION)
End Sub
date: Mon, 12 Nov 2007 09:49:22 -0000
author: unknown
RE: Disable close button on Word 2007
Hi,
DId you get an answer regarding this issue ?
I have the exact same issue
"ffimbel@gmail.com" wrote:
> Hi
>
>
> I am using the following vba code to disable the close button of
> MSWord. It works fine in all previous version of word but does not
> work for word 2007.
> Any ideas how to disable the close button of word 2007.
>
> Thanks in advance.
>
>
> Public Declare Function FindWindow Lib "User32" Alias "FindWindowA" _
> (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
> Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As
> Long, ByVal bRevert As Long) As Long
> Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu 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 ModifyMenu Lib "User32" Alias
> "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal
> wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) As
> Long
> Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long)
> As Long
>
> Private Const MF_BYPOSITION = &H400&
> Private Const MF_REMOVE = &H1000&
>
> Private Sub DesactiveX()
> 'désactiver croix de fermeture
> On Error Resume Next
> Dim Handle As Long
> Dim hMenu As Long
> Dim nCount As Long
> Handle = FindWindow("OpusApp", vbNullString)
> hMenu = GetSystemMenu(Handle, 0)
> nCount = GetMenuItemCount(hMenu)
> Call RemoveMenu(hMenu, nCount - 1, MF_REMOVE Or MF_BYPOSITION)
> End Sub
>
>
date: Tue, 5 Feb 2008 13:47:15 -0800
author: MET
Re: Disable close button on Word 2007
The code below does *exactly* what it's written to do. (I just tested it,
verbatim.)
It removes the "Close" option from the system menu in Word 2007.
I know it's not what you want to hear, but then I'm not sure the code is written to
do what you want done, either.
--
.NET: It's About Trust!
http://vfred.mvps.org
MET wrote:
> Hi,
>
> DId you get an answer regarding this issue ?
> I have the exact same issue
>
> "ffimbel@gmail.com" wrote:
>
>> Hi
>>
>>
>> I am using the following vba code to disable the close button of
>> MSWord. It works fine in all previous version of word but does not
>> work for word 2007.
>> Any ideas how to disable the close button of word 2007.
>>
>> Thanks in advance.
>>
>>
>> Public Declare Function FindWindow Lib "User32" Alias "FindWindowA" _
>> (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
>> Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As
>> Long, ByVal bRevert As Long) As Long
>> Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu 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 ModifyMenu Lib "User32" Alias
>> "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal
>> wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) As
>> Long
>> Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long)
>> As Long
>>
>> Private Const MF_BYPOSITION = &H400&
>> Private Const MF_REMOVE = &H1000&
>>
>> Private Sub DesactiveX()
>> 'désactiver croix de fermeture
>> On Error Resume Next
>> Dim Handle As Long
>> Dim hMenu As Long
>> Dim nCount As Long
>> Handle = FindWindow("OpusApp", vbNullString)
>> hMenu = GetSystemMenu(Handle, 0)
>> nCount = GetMenuItemCount(hMenu)
>> Call RemoveMenu(hMenu, nCount - 1, MF_REMOVE Or MF_BYPOSITION)
>> End Sub
date: Wed, 6 Feb 2008 12:36:27 -0800
author: Karl E. Peterson
|
|