Finance

Charts

Statistics

Macros

Search

Controls in Excel VBA

VBA provides a wide range of built-in controls that can be used on a form.
By using these controls, it is easy to create any user interface that meets all the requirements of a Windows environment.

Controls are created using the Toolbox, which is displayed either by selecting the View | Toolbox command or by clicking the Toolbox button on the Standard toolbar.

The Toolbox contains buttons for creating controls. All Toolbox buttons, except Select Objects, are used to create new controls. By clicking Select Objects, you can select an already created control on the form in order to edit it (resize or move).

NOTE
The Controls Toolbar in MS Excel (used to create controls on a worksheet) has a smaller set of objects compared to the Toolbox in the Visual Basic Editor. For example, it does not include frames, multipages, or tab strips.

Creating Controls

Creating controls on a worksheet or form usually occurs at the initial stage of application design.
Sometimes, controls are created programmatically during runtime — but this approach is used less frequently.

Toolbox Controls

Table. Controls from the Toolbox

Control Name (VBA)
TextBox
Label
CommandButton
ListBox
ComboBox
ScrollBar
SpinButton
OptionButton
CheckBox
ToggleButton
Frame
Image
MultiPage
Tab Strip  

Placing a Control on a Form

To place a control on a form:

  • Click the corresponding button on the Toolbox.
  • Using the mouse, drag the control’s frame to the desired location on the form.

After that, the control can be:

  • moved,
  • resized,
  • copied to the clipboard,
  • pasted from the clipboard,
  • or deleted from the form.
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx