Modifying the Properties of the Controls and User Form

Properties define the behavior and appearance of a control or user form.

The Properties window allows you to modify the properties of a control or user form. Selecting a an object displays its properties, while selecting more than one object displays the properties they have in common.

Working with the Properties Window

In the following steps, you learn to work with the Properties window.

  1. In the VBA IDE, one the menu bar, click View menu Properties Window or press F4 to display the Properties window.
  2. On the Properties window, click the Objects drop-down list to select the user form or a control on the user form.
  3. Optionally, click the Alphabetic or Categorized tabs to control the display order of the properties.
  4. In the Properties grid, select the property you want to work with and specify a new value.

Setting the Properties of the Option Button Controls

In the following steps, you set the properties of the two option buttons placed on the user form.

  1. On the Project window, double-click the UserForm1 module to display it in the form editor window.
  2. In the form editor window, select the control labeled OptionButton1.
  3. On the Properties window, change the following properties for the control:
    • (Name) = gp_poly
    • Accelerator = P
    • Caption = Polygon
    • ControlTipText = Polygon Tile Shape
  4. In the form editor window, select the control labeled OptionButton2.
  5. On the Properties window, change the following properties for the control:
    • (Name) = gp_circ
    • Accelerator = I
    • Caption = Circle
    • ControlTipText = Circle Tile Shape
  6. Save the project.

Setting the Properties of the Label Controls

In the following steps, you set the properties of the three labels placed on the user form.

  1. On the Properties window, change the following properties of the control labeled Label1:
    • (Name) = label_trad
    • Caption = Radius of tiles
    • TabStop = True
  2. On the Properties window, change the following properties of the control labeled Label2:
    • (Name) = label_tspac
    • Caption = Space between tiles
    • TabStop = True
  3. On the Properties window, change the following properties of the control labeled Label3:
    • (Name) = label_tsides
    • Caption = Number of sides
    • TabStop = True
  4. Save the project.

Setting the Properties of the Text Box Controls

In the following steps, you set the properties of the two text boxes placed on the user form.

  1. On the Properties window, change the following properties of the control labeled TextBox1:
    • (Name) = gp_trad
  2. On the Properties window, change the following properties of the control labeled TextBox2:
    • (Name) = gp_tspac
  3. On the Properties window, change the following properties of the control labeled TextBox3:
    • (Name) = gp_tsides
  4. Save the project.

Setting the Properties of the Command Button Controls

In the following steps, you set the properties of the two command buttons placed on the user form.

  1. On the Properties window, change the following properties of the control labeled CommandButton1:
    • (Name) = accept
    • Accelerator = O
    • Caption = OK
    • ControlTipText = Accept the options
    • Default = True
  2. On the Properties window, change the following properties of the control labeled CommandButton2:
    • (Name) = cancel
    • Accelerator = C
    • Cancel = True
    • Caption = Cancel
    • ControlTipText = Cancel the operation
  3. Save the project.

Setting the Properties of the User Form

In the following steps, you set the properties of the user form.

  1. Select the user form; click in an area on the user form that doesn't contain a control.
  2. On the Properties window, change the following properties of the user form:
    • (Name) = gpDialog
    • Caption = Garden Path

    The form should look similar to the following illustration:

  3. Save the project.