Form Controls


Using the Shapes Collection

This is the only method you use to refer to controls that have been added from the Forms toolbar.

ActiveSheet.Shapes("Check Box 1").Select 
ActiveSheet.Shapes("Check Box 1").LinkedCell = "H2"
Dim shShape As Shape
For Each shShape in ActiveSheet.Shapes
   If shShape.Type = msoFormControl Then
      shShape.Select
   End If
Next shShape

Adding Controls

Dim objButton As Variant 
Set objbutton = Worksheets("Sheet1").Buttons.Add(20,20,20,20)

Dim objCheckBox As Variant 
Set objcheckbox = Activesheet.Checkboxes.Add(Left, Top, Width, Height)

ActiveSheet.Shapes.AddFormControl 

Handling Events

The controls on the Forms toolbar can only respond to a single event, the click event.
The only exception is the Edit control which responds to a Change event.



© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext