Common Programmatic IDs
Programmatic IDs (progIDs) are used by several methods to create new instances of objects. For example, the following code creates a new checkbox on the active worksheet:
Sub AddCheckBox( )
Dim ole As OLEObject
' Add new check box.
Set ole = ActiveSheet.OLEObjects.Add("Forms.CheckBox.1", _
, , , , , , 60, 60, 100, 20)
' Select the check box.
ole.Object.Value = True
' Set its caption
ole.Object.Caption = "New Check Box"
End SubTable A-2 lists common applications and the objects that they provide, along with the progIDs used to create those objects in code.
Table A-2. Common programmatic IDs (continued)
|
Application |
Object |
ProgID |
|---|---|---|
|
ActiveX Controls |
CheckBox |
Forms.CheckBox.1 |
|
ComboBox |
Forms.ComboBox.1 | |
|
CommandButton |
Forms.CommandButton.1 | |
|
Frame |
Forms.Frame.1 | |
|
Image |
Forms.Image.1 | |
|
Label |
Forms.Label.1 | |
|
ListBox |
Forms.ListBox.1 | |
|
MultiPage |
Forms.MultiPage.1 | |
|
OptionButton |
Forms.OptionButton.1 | |
|
ScrollBar |
Forms.ScrollBar.1 | |
|
SpinButton |
Forms.SpinButton.1 | |
|
TabStrip |
Forms.TabStrip.1 | |
|
TextBox |
Forms.TextBox.1 | |
|
ToggleButton |
Forms.ToggleButton.1 | |
|
Calendar |
MSCal.Calendar | |
|
Microsoft Access |
Application |
Access.Application |
|
CurrentData |
Access.CodeData | |
|
Access.CurrentData | ||
|
CurrentProject |
Access.CodeProject | |
|
Access.CurrentProject | ||
|
DefaultWebOptions |
Access.DefaultWebOptions | |
|
Microsoft Excel |
Application |
Excel.Application |
|
Workbook |
Excel.AddIn | |
|
Workbook |
Excel.Chart | |
|
Workbook |
Excel.Sheet | |
|
Microsoft Graph |
Application |
MSGraph.Application ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access