VBA Word 2003 TreeView DblClick

Joined
May 13, 2009
Messages
1
Reaction score
0
I have a TreeView control on a userform in Word 2003. The userform is displayed on the right of the word-application. By double clicking a node in the TreeView some text is placed into the ActiveDocument and the userform is closed. In the dblclick event of the treeview I want to maximize the ActiveWindow by:

ActiveWindow.WindowState = wdWindowStateMaximize.

In other code of the same userform the exact same statement works but it doesn't in the sub of the dblclick event. If I go to debug mode and step through the code, the ActiveWindow actually maximizes, what seems very strange to me.

Trying to maximize the ActiveWindow from userform_queryclose doesn't work either.

Any ideas for workarounds?

the part of the code:

Code:
<snip>
if ... then
<snip>
If ActiveWindow.WindowState <> wdWindowStateMaximize Then ActiveWindow.WindowState = wdWindowStateMaximize
lngStartOffset = Selection.Start
Selection.InsertFile FileName:=strFileName, ConfirmConversions:=False, Link:=False, Attachment:=False
ActiveDocument.Range(lngStartOffset, lngStartOffset).Select
Selection.Collapse wdCollapseStart
Set objTreeNode = Nothing
' Debug.Print "active:" & ActiveWindow.Active
Call Me.Quit
end if
<snip>
 

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