|
-
Apr 7th, 2005, 04:37 PM
#1
Thread Starter
Hyperactive Member
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
Last edited by MJBNET; Apr 7th, 2005 at 08:00 PM.
Reason: reesolved
-
Apr 7th, 2005, 05:41 PM
#2
Re: closing VBE windows programatically...
You can use the index number instead of the name.
VB Code:
Application.VBE.Windows.Item(1).close
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 7th, 2005, 07:58 PM
#3
Thread Starter
Hyperactive Member
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 "~"
-
Apr 7th, 2005, 08:22 PM
#4
Re: closing VBE windows programatically...[resolved]
Looks ok but what are you trying to accomplish? Looks like it just closes the VBA IDE.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 7th, 2005, 08:57 PM
#5
Thread Starter
Hyperactive Member
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...
-
Apr 7th, 2005, 08:59 PM
#6
Re: closing VBE windows programatically...[resolved]
Ok, now I see where all this fits in.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|