closing VBE windows programatically...[resolved]
can i close these windows without the exact caption ?
if not how do i find it ?
i want to wind up with an empty VBE gray screen, just the menu bar & tools...
...this works..but i cheated...
VB Code:
Application.VBE.Windows("Project - STOCKBOOK").Close
Application.VBE.Windows("Properties - Module18").Close
Re: closing VBE windows programatically...
You can use the index number instead of the name.
VB Code:
Application.VBE.Windows.Item(1).close
Re: closing VBE windows programatically...
thankx man...i applied it in this code and so far perfect...gray screen and all !!
if ya see any potential flaws...lemme know...txx again:)
VB Code:
Dim idx As Integer
Application.VBE.MainWindow.Visible = True
Application.VBE.MainWindow.SetFocus
Do Until InStr(1, Application.VBE.activewindow.Caption, "[running]") <> 0
Application.VBE.activewindow.Close
Loop
idx = 0
Do Until idx = Application.VBE.Windows.Count
idx = idx + 1
Application.VBE.Windows.Item(idx).Close
Loop
Application.VBE.CommandBars("Menu Bar").Controls("Tools").SetFocus
SendKeys "~"
SendKeys "~"
Re: closing VBE windows programatically...[resolved]
Looks ok but what are you trying to accomplish? Looks like it just closes the VBA IDE.
Re: closing VBE windows programatically...[resolved]
yes it's a work around to deal with this situation:
we put a workbook from one comp to another.
then remove broken refs if any...
---Application.VBE.ActiveVBProject.References.Remove ref---
why do this ? ... i found a workbook can have refs it does not need...But it will cause an error in a procedure that has nothing to do with that library...ie.. you'll get an error on the "UCase" function for a broken ref to some totally unrelated lib...
Now ya think ---Application.VBE.ActiveVBProject.References.Remove ref--- would fix that...but because the ref never existed on that comp...it generates ar runtime error [-2147319779 object library not registered]........so we open the reference window ...let the user untick the missing ref...
..and to finally answer why close all IDE ...simply 'cause it's less confusing if there is nothing behind the references window but a peacefull gray screen...
Re: closing VBE windows programatically...[resolved]
Ok, now I see where all this fits in. :p