Search code examples
vbaexceluserform

Using the Properties Window to identify controls on a form


With a control selected on a form, at the very top of the Properties Window the name and type of the control are displayed, and on the dropdown menu underneath there's a list with some more controls. If I click on one of the list items, it selects that control on the form.

1) What is the proper name for this dropdown menu?

2) What determines which controls appear on the dropdown list?

3) How can I make any given control appear on the dropdown list? i.e. on a very busy form, I know I have a certain control on there somewhere but I can't see it. I'd like to select it on the dropdown menu so it will make its location known, but I don't know how to get it on that menu.


Solution

  • I'd call it the Property Windows dropdown. It seems the controls are displayed in a hierarchical/outlined manner, although not always an intuitive one.

    For example, I’ll refer to a form with a Frame, a Multipage and a Commandbutton control, which I’ll call the “top-level” controls.

    There are two levels of control selection: one where the control is bordered by light stipples, and another where it’s bordered by dark hash marks. I call the first “activating” and the second “selecting.” You can “activate” a control by tabbing to it, or by choosing it in the Property Windows dropdown. You can “select” it by tabbing to it and then clicking Enter, or by clicking just inside its border. (If you activate a control by choosing it in the Property Windows dropdown, clicking Enter won’t select it.)

    When you first select the Userform it will show in the dropdown. When you click the dropdown list the three top-level controls are listed. If you activate the Multipage by choosing it in the dropdown your dropdown choices won’t change. If you select the Multipage (as described above) the Multipage, it’s currently active Page and the controls on that Page will be listed. The UserForm itself will not be listed. If you select the Frame in the same manner you’ll have similar results: the Frame and its top-level controls will be listed and the UserForm won’t be listed.

    I think the best way to navigate a complex form is by tabbing. If you have the form selected and start to tab, you’ll cycle through all the top-level controls. Clicking Enter takes you “into” the control. If that control has sub-controls (e.g., the Multipage) you can then tab through them. Hitting Enter on a control that doesn’t have sub-controls puts you in edit mode for that control. For example, hitting Enter with a Commandbutton activated puts you in caption edit mode.

    If you’re “inside” a control with sub-controls, such as the Frame, you can then tab through the sub-controls. Once you’ve tabbed through all the sub-controls, clicking Tab will take you back up a level, e.g., the Commandbutton will be selected.

    Note that you can also “back out” to the next level up by hitting the Esc key. So if you’re in edit mode on the button, Esc will take you back to just selecting the button. If you’ve selected a control inside the frame, Esc will select the Frame. Hitting Esc multiple times takes you back to the root level where the form itself is selected.

    I didn’t know most of this until your question sparked me to investigate, so thanks for helping me learn! It’s a confusing topic, so I hope my writing is somewhat clear.