Share via

Can't programmatically maximize VB editor

Anonymous
2012-02-23T04:31:52+00:00

In Word 2003, this line:

VBE.ActiveWindow.WindowState = vbext_ws_Maximize

used to work to maximize the VBE. It doesn't seem to anymore, in 2010.  The line doesn't throw an error, it just gets ignored..References include VBA Extensibility (5.3).

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Andreas Killer 144.1K Reputation points Volunteer Moderator
2012-02-28T17:28:19+00:00

Forget the reference, the reference is only related for the "vbext_ws_Maximize" constant.

You said: "the line is ignored", that means that your settings trust the VBA project is set properly, otherwise you'll get an RTE 6068.

Well, your description can only mean that the line is executed and works, but not in the way that you expected. .-)

Please execute this sub:

Sub Test()

  VBE.ActiveWindow.WindowState = 0

End Sub

As you see, the VBE is a multiple windows application, like Excel. With this property you can only size the window inside the VBE, not the VBE itself.

If you want to maximize the VBE itself, you must use the MainWindow object instead.

Sub Test()

  VBE.MainWindow.WindowState = vbext_ws_Maximize

End Sub

Andreas.

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2012-02-28T20:39:23+00:00

    Ahh, thank you, Andreas! That does what I need.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-02-28T14:45:03+00:00

    Yes, as I said in the original post, the Extensibility 5.3 reference is set.  And only one version of Word is running.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-02-28T07:24:51+00:00

    Yes, that is the file's size.

    Hello,

    Then have you referenced Microsoft Visual Basic for Applications Extensibility 5.3in Tools >> References and are you running different versions of Word on your PC?

    Cristin

    Was this answer helpful?

    0 comments No comments