Add Method (Commands Object)

      Applies To

Adds the command, as represented by the GUID and ID, to the Commands object.

Syntax

Sub Add (Guid As String, ID As Long, [Control As CommandBarControl])

This syntax has these parts:

Part Description
Guid Required String. The GUID for the command group.
ID Required Long. The index into the command group for the particular command.
Control Optional. The CommandBarControl that when clicked by the user causes the command specified by Guid and ID to fire.

Remarks

If Control is supplied, then when the user clicks the control (it must have previously been added to a command bar), an event handler executes the specified command.