Accessing your Controls Directly
Any object which is embedded on a worksheet appears in the Drawing layer.
There are several ways to access the objects in the Drawing layer:
1) Use the Shapes collection.
2) Use the OLE Objects collection (Control Toolbar controls only).
3) Refer to the specific name of the object (Control Toolbar controls only).
The first two methods are useful if you want to loop through all the controls on a particular worksheet.
Application.Caller
This property can be very useful for finding out which drawing object activated a procedure
Using the Shapes Collection
This method can be used to refer to controls that have been added from the Control Toolbox toolbar.
Dim shShape As Shape
For Each shShape in ActiveSheet.Shapes
If shShape.Type = msoOLEControlObject Then
shShape.Select
End If
Next shShape
Command Button fonts - Perpetua Titling MT, Rockwell, Sylfaen
Shape Object Summary
This table summarises the different types of objects that can be embedded in the Drawing layer
Shape | No. | Description | Shape | No. | Description |
msoAutoShape | 1 | msoLinkedPicture | 11 | ||
msoCallout | 2 | msoOLEControlObject | 12 | ||
msoChart | 3 | msoPicture | 13 | ||
msoComment | 4 | msoPlaceholder | 14 | ||
msoFreeform | 5 | msoTextEffect | 15 | ||
msoGroup | 6 | msoMedia | 16 | ||
msoEmbeddedOLEObject | 7 | msoTextBox | 17 | ||
msoFormControl | 8 | msoScriptAnchor | 18 | ||
msoLine | 9 | msoTable | 19 | ||
msoLinkedOLEObject | 10 | msoShapeTypeMixed | -2 |
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext