Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Key board short cut (Word 97SR2)

    Is there a keyboard short cut to close all open windows in the VBA IDE except the IDE itself?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Key board short cut (Word 97SR2)

    If you close all the open windows, what's left besides the menus?
    Charlotte

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Ok, ok. I mean all open code and form and class mod windows. Not the Project Explorer or Immediate windows, etc.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Kevin,

    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 Sub


    so 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?

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Brooke,

    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.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #6
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    I was about to say why don't you know those, but they are excel sites, so maybe I'll let you off.

    <A target="_blank" HREF=http://www.cpearson.com/>http://www.cpearson.com/</A>

    <A target="_blank" HREF=http://www.j-walk.com/>http://www.j-walk.com/</A>

  7. #7
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Key board short cut (Word 97SR2)

    Chip is Chip Pearson, <A target="_blank" HREF=http://www.cpearson.com/>http://www.cpearson.com/</A> and . J-Walk is John Walkenbach, <A target="_blank" HREF=http://j-walk.com/ss/>http://j-walk.com/ss/ Finally, <A target="_blank" HREF=http://www.mvps.org/links.html#Excel>http://www.mvps.org/links.html#Excel</A> is the site to add to your favorites: it has links to the above and all of the rest of the MS Excel MVPs.
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    See what I miss looking at Word all day??

    Thanks for the links.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Thanks, Sammy.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  10. #10
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Brooke,

    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.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  11. #11
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    I did a long search that opened just about every module and form in the project. With all those windows opened, I said to myself, "Hey, I'll try Brooke's C sub to close this beastly mess." Guess what?

    "Object variable or with block variable not set."

    Beats me...
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  12. #12
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Hmmm. Working fine for me. What references have you got?
    Attached Images Attached Images

  13. #13
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Ah.

    Let me go off and stand in the corner for a bit - forms aren't codepanes are they? <img src=/S/doh.gif border=0 alt=doh width=15 height=15> <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

    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 Sub

    You'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!

  14. #14
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    Now you'r talkin'

    I'll run this code in just a sec, but I think you nailed it. Hang on...
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  15. #15
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key board short cut (Word 97SR2)

    You 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
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •