Is there a keyboard short cut to close all open windows in the VBA IDE except the IDE itself?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Key board short cut (Word 97SR2)
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Key board short cut (Word 97SR2)
- This topic has 17 replies, 4 voices, and was last updated 21 years, 3 months ago.
Viewing 0 reply threadsAuthorReplies-
WScharlotte
AskWoody Lounger -
WSKevin
AskWoody Lounger -
WSBrooke
AskWoody LoungerJanuary 24, 2002 at 5:56 pm #565822Kevin,
I don’t know of a built-in shortcut. However…….
This seems to work. I’m not sure why because I can do very little with cp, but hey.
Sub CodePaneCloseVBE()
For Each cp In Application.VBE.CodePanes
Application.VBE.ActiveCodePane.Window.Close
Next
End Subso you can run this from the application of your choice (excel for me, and no, I haven’t tested it in anything else) via menu or assigned shortcut. Not precisely what you want, I fear.
so the next option is to call the sub from the immediate window – if you have it open all the time. You’d probably want to call the sub something like Sub C() if you go down that route and you of course have to have the code in an open workbook or document.
so the next option is to modify the vbe menu’s. Which I believe requires Class modules. again, an always open workbook/document. I have done this with ripped code. I thought there was something about it here on the lounge but I’ve skimmed thru every post including “VBE” in it in VB/VBA/.NET and didn’t see it (Note to me: must go back through that list at some point). So if it wasn’t here it would most likely have been Chip or J-Walk. I’ll try and have a look for it but no promises!
On the whole, from excel where I’ve almost always got a tools file open anyway, I’d prefer the second option. unless I run into someone else naming their subs after letters of the alphabet – but then I’d get ambiguous name alerts so it wouldn’t be too much of a problem, would it?
-
WSKevin
AskWoody LoungerJanuary 24, 2002 at 6:05 pm #565825Brooke,
Thanks for that little routine. It works fine, but of course, running from the VBE is the ticket. I like your idea of naming it C and calling it from the Immediate window which is usually always open. So, I’ll use it there for now.
But modifying the VBE menu is something I’d like to know how to do. I’ve looked for info on this in the past, but found nothing. Who or what are Chip and J-Walk? I’ll hit the net, but I’m sure chip will return snack food sites, etc. Can you update me on these? Thanks.
-
WSBrooke
AskWoody LoungerJanuary 24, 2002 at 6:53 pm #565845I was about to say why don’t you know those, but they are excel sites, so maybe I’ll let you off.
-
WSKevin
AskWoody Lounger -
WSBrooke
AskWoody LoungerMarch 13, 2004 at 3:47 pm #567937(Edited by HansV to update link to Excel MVP site)
Just wondering how you were getting on with this – I’ve only just started to play with it again myself. The link Sammy gives is good but you need to go in one link further to the http://www.cpearson.com/excel/vbemenus.htm%5B/url%5D page. I know this is all in excel but hey, it should work for you. An additional link on this subject is http://www.bmsltd.ie/O2000/Default.htm%5B/url%5D again in excel, you’re looking for the VBEtools2000 download – it should be translatable to word. Neither of these is actually what I vaguely remembered seeing before – I still haven’t rediscovered that – but they are both using the same method of class modules. The second link gives an alternative method of closing all the code panes different to the one I supplied as well as a few other interesting things
-
WSKevin
AskWoody LoungerFebruary 4, 2002 at 5:50 pm #568184Brooke,
The links point to excellent resources. I’ve only started to test the Pearson approach. I’m hoping I don’t need the VBAE library reference for the production code. But I’ll give it a go sooner or later. It would be nice to add a button for the “close all code windows” and “clear the immediate window” function. Thanks for keeping me informed.
-
WSKevin
AskWoody LoungerFebruary 7, 2002 at 10:40 pm #569021 -
WSBrooke
AskWoody Lounger -
WSBrooke
AskWoody LoungerFebruary 8, 2002 at 4:20 pm #569134Ah.
Let me go off and stand in the corner for a bit – forms aren’t codepanes are they?
From the above you will see that I’ve succesfully replicated your error message. Wasn’t that clever of me?
Back to the drawing board.
Sub please_work()
Dim Pain As VBIDE.Window
For Each Pain In Application.VBE.Windows
If Pain.Type = vbext_wt_Designer Or Pain.Type = vbext_wt_CodeWindow Then Pain.Close
Next
End SubYou’ll need the extensibility reference set though, which I think you said you’d prefer not to have to do.
Please tell me this works!
-
WSKevin
AskWoody Lounger -
WSKevin
AskWoody LoungerFebruary 8, 2002 at 4:30 pm #569144You indeed nailed this one. I flavored it to run without the VBAE ’cause that’s just the way I am.
Sub C() ‘CodePaneClose
Dim wp As Object
‘Dim wp As VBIDE.Window
For Each wp In Application.VBE.Windows
Select Case wp.Type
Case 0, 1 ‘ 0 = vbext_wt_CodeWindow : 1 = vbext_wt_Designer
wp.Close
End Select
Next
End Sub -
WSBrooke
AskWoody Lounger -
WSKevin
AskWoody Lounger -
WSSammyB
AskWoody LoungerJanuary 24, 2002 at 7:01 pm #565847Chip is Chip Pearson, http://www.cpearson.com/ and . J-Walk is John Walkenbach, http://j-walk.com/ss/%5B/url%5D Finally, http://www.mvps.org/links.html#Excel is the site to add to your favorites: it has links to the above and all of the rest of the MS Excel MVPs.
-
WSKevin
AskWoody Lounger
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
AMD : Out of Bounds (OOB) read vulnerability in TPM 2.0 CVE-2025-2884
by
Alex5723
10 hours, 5 minutes ago -
Totally remove or disable BitLocker
by
CWBillow
8 hours, 59 minutes ago -
Windows 10 gets 6 years of ESU?
by
n0ads
5 hours, 48 minutes ago -
Apple, Google stores still offer China-based VPNs, report says
by
Nibbled To Death By Ducks
20 hours, 52 minutes ago -
Search Forums only bring up my posts?
by
Deo
21 hours, 5 minutes ago -
Windows Spotlight broken on Enterprise and Pro for Workstations?
by
steeviebops
1 day, 8 hours ago -
Denmark wants to dump Microsoft for Linux + LibreOffice
by
Alex5723
1 day, 1 hour ago -
How to get Microsoft Defender to honor Group Policy Setting
by
Ralph
1 day, 9 hours ago -
Apple : Paragon’s iOS Mercenary Spyware Finds Journalists Target
by
Alex5723
1 day, 19 hours ago -
Music : The Rose Room – It’s Been A Long, Long Time album
by
Alex5723
1 day, 20 hours ago -
Disengage Bitlocker
by
CWBillow
1 day, 10 hours ago -
Mac Mini M2 Service Program for No Power Issue
by
Alex5723
1 day, 22 hours ago -
New Win 11 Pro Geekom Setup questions
by
Deo
21 hours ago -
Windows 11 Insider Preview build 26200.5651 released to DEV
by
joep517
2 days, 5 hours ago -
Windows 11 Insider Preview build 26120.4441 (24H2) released to BETA
by
joep517
2 days, 5 hours ago -
iOS 26,, MacOS 26 : Create your own AI chatbot
by
Alex5723
2 days, 9 hours ago -
New PC transfer program recommendations?
by
DaveBoston
14 hours, 31 minutes ago -
Windows 11 Insider Preview Build 22631.5545 (23H2) released to Release Preview
by
joep517
2 days, 13 hours ago -
Windows 10 Build 19045.6029 (22H2) to Release Preview Channel
by
joep517
2 days, 13 hours ago -
Best tools for upgrading a Windows 10 to an 11
by
Susan Bradley
2 days, 2 hours ago -
The end of Windows 10 is approaching, consider Linux and LibreOffice
by
Alex5723
1 day, 6 hours ago -
Extended Windows Built-in Disk Cleanup Utility
by
bbearren
1 day, 14 hours ago -
Win 11 24H2 June 2025 Update breaks WIFI
by
dportenlanger
3 days, 8 hours ago -
Update from WinPro 10 v. 1511 on T460p?
by
CatoRenasci
2 days, 6 hours ago -
System Restore and Updates Paused
by
veteran
3 days, 11 hours ago -
Windows 10/11 clock app
by
Kathy Stevens
2 days, 22 hours ago -
Turn off right-click draw
by
Charles Billow
3 days, 14 hours ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
3 days, 17 hours ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
6 hours, 21 minutes ago -
Master patch listing for June 10, 2025
by
Susan Bradley
3 days, 19 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.