Window Manipulation

  • Thread starter Thread starter BillCPA
  • Start date Start date
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
 
Application.VBE.Windows("Immediate")
Application.VBE.Windows("Watches")
Application.VBE.Windows("Project - VBAProject")

If this post helps click Yes
 
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)
 
Back
Top