Window Manipulation

B

BillCPA

Using the following code, I can change the size and location of the windows
in the VBA Editor that display the VBA code and forms. Is there some way to
do the same with the other windows - project window, watch window, etc.?

ThisWorkbook.VBProject.VBComponents(name).CodeModule
ThisWorkbook.VBProject.VBComponents(name).DesignerWindow
 
J

Jacob Skaria

Application.VBE.Windows("Immediate")
Application.VBE.Windows("Watches")
Application.VBE.Windows("Project - VBAProject")

If this post helps click Yes
 
C

Chip Pearson

You can get a reference to these window with code like the following.
Once you have the reference, you can move and size them as you like.

Dim ImmWindow As VBIDE.Window
Dim WatchWindow As VBIDE.Window
Dim ProjectWindow As VBIDE.Window
Dim W As VBIDE.Window

For Each W In Application.VBE.Windows
Select Case W.Type
Case vbext_wt_Immediate
Set ImmWindow = W
Case vbext_wt_Watch
Set WatchWindow = W
Case vbext_wt_ProjectWindow
Set ProjectWindow = W
Case Else
' ignore
End Select
Next W

Debug.Print ImmWindow.Caption, ImmWindow.Visible
Debug.Print WatchWindow.Caption, WatchWindow.Visible
Debug.Print ProjectWindow.Caption, ProjectWindow.Visible

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

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