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
 
W

Word Heretic

G'day (e-mail address removed),

Write a shell and call word as a client.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


(e-mail address removed) reckoned:
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top