Disable Maximize and minimze menu of a Word document

D

d.gallone

Hi,

I'm using Word 2002 with VBA.

Is it possible to disable the Maximize and Minimze menu of a Word
document inside Word ?

I try this but no effect :
Dim wrdWnd As Long
Dim x As Long, docwnd As Long
Dim lStyle As Long
Const GWL_STYLE = (-16)
Const WS_MAXIMIZEBOX = &H10000
Const WS_MINIMIZEBOX As Long = &H20000

wrdWnd = FindWindow("OpusApp", 0&)
x = FindWindowEx(wrdWnd&, 0, "_Wwf", "")
x = FindWindowEx(wrdWnd&, x, "_Wwf", "")
docwnd = FindWindowEx(x, 0, "_Wwb", "test.doc")
lStyle = GetWindowLong(docwnd, GWL_STYLE)
--> lStyle has the value "1455489024" but doesn't change after the
following lines
lStyle = lStyle Or (WS_MAXIMIZEBOX) ' Maximize
lStyle = lStyle And Not (WS_MINIMIZEBOX) ' Minimize
Call SetWindowLong(docwnd, GWL_STYLE, lStyle)

It works if I change the Maximize and Minimze menu of Word, but not for
the documents open inside Word!

Thank for your help,
David GALLONE
 
T

Tony Jollans

For a single document, in a module in the document add this code:

Sub DocMinimize()
End Sub
Sub DocMaximize()
End Sub

To apply to all documents put it in Normal or another global template
instead.
 
Top