The computer mouse has made life a lot easier for computer users and for most people "point-and-click" is the method of choice for navigating computer applications. But the die-hard command users prefer access key combinations, typically using the Alt key, to make their lives easier. Visual Basic makes such keys available that can be turned on for any control on the screen.
Build the Visual Basic form for your application, using Windows standards for menu items, buttons and other standard controls. Windows standards are implemented in every Microsoft application so you have to look no further than Microsoft Visual Basic itself for most of them. Any underlined letter in the text of a menu item, button or other control identifies the access key for that control.
Determine the controls on your Visual Basic form for which you want to assign access keys. Decide which key will be your access key for each control. Of course, each control must have a different key for your application to determine which control your access key combination is to invoke.
Click on a control such as the "File" menu item to select it. Scroll down in the Properties window to find the Text property for the control. Insert an ampersand (&) before the character that you want to be the access key. For example, the Text property of the File menu item would be "&File" to make Alt-f the access key combination.
Click the Debug menu item at the top of the Visual Basic screen to test your access keys. When your form appears press the Alt key to see an underline under the access key in the File menu item. Hold down the Alt key and press "f" to activate the File menu item. This indicates that you have successfully set the access key.
- IPTraf: Visual Basic -- Access Key
- FreeTutes: Assigning an Access Key to a Textbox Control Through a Label's Caption
- "Programming in Visual Basic 2010"; Bradley and Millspaugh; 2011; McGraw-Hill
- Photo Credit Ryan McVay/Photodisc/Getty Images
How to Use Sendkeys in Excel
Excel is a spreadsheet program included in the Microsoft Office suite of productivity software. It is commonly available on PCs and Macs....