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 Sub

Table 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 ...

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.