Returns the ID for a built-in command bar control. Read-only Long.
expression.Id
expression Required. An expression that returns one of the above objects.
Remarks
A control's ID determines the built-in action for that control. The value of the Id property for all custom controls is 1.
Id property as it applies to the Script object.
Sets or returns the ID of a Script object. Read/write String.
expression.Id
expression Required. An expression that returns a Script object.
Remarks
The ID returned is the ID attribute of the <SCRIPT> tag in HTML. If there’s no ID attribute specified in the <SCRIPT> tag, the Id property returns an empty string.
Id specifies an SGML identifier used for naming elements. Valid identifiers include any string that begins with a letter and is composed of alphanumeric characters; the string can also include the underscore character ( _ ).
The ID must be unique within the HTML document.
Example
As it applies to the CommandBarButton, CommandBarComboBox, and CommandBarControl objects.
This example changes the button face of the first control on the command bar named "Custom2" if the button's ID value is less than 25.
Set ctrl = CommandBars("Custom").Controls(1)
With ctrl
If .Id < 25 Then
.FaceId = 17
.Tag = "Changed control"
End If
End With
The following example changes the caption of every control on the toolbar named "Standard" to the current value of the Id property for that control.
For Each ctl In CommandBars("Standard").Controls
ctl.Caption = CStr(ctl.Id)
Next ctl
As it applies to the Script object.
This example sets the Id property of the first script in worksheet one of the active workbook to a new value.
ActiveWorkbook.Worksheets(1).Scripts(1).Id = "UpdatedScriptName"