Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hunting for a VBA keystroke 3

Status
Not open for further replies.

larryww

Programmer
Mar 6, 2002
193
0
0
US
In my quest for world's laziest - I mean, most energy expenditure efficient - I am looking for a keystroke to close the project window (the one that opens with Control-R).

[spineyes] It's sapping my strength to have to reach over to the mouse to do that. [yawn] Is there a "Close" counterpart to Ctrl-R?
 
Hi larryww,

PREFACE
=======
It’s GREAT to see that there ARE others who are ALSO concerned about being “most energy expenditure efficient”. And as you correctly pointed out, this can OFTEN be accomplished by using HOTKEYS instead of the mouse.

EVEN for those who don’t know the keyboard, it won’t take long to become familiar with your personalized set of HOTKEYS and you’ll become AMAZED at how much FASTER you with your HOTKEYS.

OBJECTIVE
=========
A) To create a HOTKEY for: Hiding “Project Explorer” – with HOTKEY of <Alt> ` (the key to the left of the number “1” (top left of keyboard).

B) To create a HOTKEY for: Activating “Project Explorer” – with HOTKEY of <Alt> “1” (top left of keyboard). Note: You’ll find that using this alternative will be easier than using <Ctrl> R – and it will become more “automatic” (natural) – because of the two keys being side-by-side – the “1” and the key to its left – the ` character.

STEPS FOR “A”
=============
1) Use <Alt> <F11> to activate the Visual Basic Editor. For those “new” to Excel, when <Alt> is referred to, it means to HOLD DOWN the <Alt> key, while hitting the next key. (Same with the <Ctrl> key).

2) On the toolbar area, right-click and choose “Customize”.

3) Click on the “Toolbars” tab.

4) Check the “Shortcut Menus” box. This will open a “Shortcut Menus” window.

5) In the “Shortcut Menus” window, click on “Code Windows”, and the click on “Locals Window”.

6) On the bottom of the “fly-out”, there should be “Hide”. Click-and-Drag this to a place on one of your existing toolbars.

7) Right-click on the “Hide” icon (which is probably showing no actual icon – just gray on gray)

8) On the pulldown, click in the “Name” box (3rd from the top), and right after the “&” character, enter the ` character (the character to the left of the number “1” (top left of keyboard).

9) Now (from the same pulldown), click on “Text Only (Always)”.

STEPS FOR “B”
=============
1) While still in the “Customize” window, click on the “Commands” tab.

2) Under “Categories” (on the left), click on “View”.

3) Under “Commands” (on the right), scroll down until you come to the “Project Explorer” icon.

4) Click-and-Drag the “Project Explorer” icon to the toolbar, next to your “Hide” icon.

5) Right-click on the “Project Explorer” icon.

6) On the pulldown, click in the “Name” box (3rd from the top), and right after the “&” character, enter the “1” character (the number “1” - top left of keyboard). (Note: You can abbreviate the text, if you need to get it to fit on your toolbar.)

7) Now (from the same pulldown), click on “Text Only (Always)”.

8) From the “Customize” window, click on “Close”. You’re done.


REVIEW OF THE USE OF THESE HOTKEYS
==================================
1) First activate the VB Editor - with <Alt> <F11>.

2) <Alt> 1 – to activate “Project Explorer”

3) <Alt> ` - to Hide “Project Explorer”

4) When in “Project Explorer”, you can use the DOWN or UP ARROW-Keys to choose from different Modules, Sheets or Forms, or Workbooks.

5) When you are “ON” the item (Module for example) that you want, hitting the <ENTER> key will take you to the “CODE” side (right side).

6) <Alt> 1 – will take you “back” to the “Project Explorer” side (left side).

7) <Alt> ` – will then HIDE the “Project Explorer” window, and

8) <Alt> 1 – will bring “Project Explorer back. With these keys being “next to each other”, it’s almost like a “toggle” effect.

Larry, I’m confident that you’ll be very pleased with this solution. ...”Happy Hotkeying” :)

I hope others will “give this a try”. I’m VERY confident that once you get used to using these “hotkeys”, you’ll “wish you would have started MUCH earlier.

Feedback would be appreciated, positive or negative. :) And of course if you encounter any difficulties, please contact me via email or post the difficulty.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Thanks for your SOLUTION which I don't always get to say. Wtg! I grew a lot from your post - things I've been needing for a long time and never learned.

You are correct, sir. Since long-term computer veterans are most often seen using them, hotkeys might appear to be an artifact of inefficient dinosaurs. Totally Nay!

In fact, being mouse-bound (you know, fighting to find the button,icon or control to click, as opposed to just instantly hitting (e.g.) alt-F4 or Ctrl-Tab) ... is more of an indication that you are just &quot;coping with&quot; PCs as opposed to &quot;taking command.&quot; In about 97% of the cases where they are available, hotkeys do make things go as fast or faster(efficient!). Like when my fingers are typing code, ergo my question!!

And Dale: well done answer - explicit, accurate, context-providing, and of course useful. I used it to the letter. Well, except on item 2, I used the menu area - I don't have no stinkin' toolbar sucking my vertical space there, lol. *

Thanks again.

* [sub](I'll agree that some toolbar clicks are just as good as key equivalents; but it's best to have both weapons. In this case not only do I get the vertical buzz, but almost every icon on the standard toolbar is a single keystroke anyway [Insert Form,save and design mode are two ... close enough :)]). [/sub]
 
Larry,

THANKS for your positive response.

I'm naturally quite pleased that you've found the &quot;hotkey&quot; solution useful.

I only hope &quot;others&quot; will take the time to try this approach.

Please allow me to give you a STAR - for your &quot;inspiration&quot; for me to find and create this particular hotkey, and ALSO to (hopefully) &quot;catch the attention&quot; of those other VBA users who can...

<<< ALSO BENEFIT from these particular HOTKEYS >>>

[sunshine] [sunshine] [sunshine] [sunshine] [sunshine] [sunshine] [sunshine] [sunshine] [sunshine]

...&quot;gotta get your attention somehow&quot; :) :) :)

I'm obviously anxious for someone else to be &quot;brave enough&quot; to give this a try.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top