State Property

Microsoft Office Object Model

Show All

State Property

       

State property as it applies to the CommandBarButton object.

Returns or sets the appearance of a command bar button control. Read/write MsoButtonState.

MsoButtonState can be one of these MsoButtonState constants.
msoButtonDown
msoButtonMixed
msoButtonUp

expression.State

expression   Required. An expression that returns a CommandBarButton object.

State property as it applies to the HTMLProject object.

Returns the current state of an HTMLProject object. Read-only MsoHTMLProjectState.

MsoHTMLProjectState can be one of these MsoHTMLProjectState constants.
msoHTMLProjectStateDocumentLocked
msoHTMLProjectStateDocumentProjectUnlocked
msoHTMLProjectStateProjectLocked

expression.State

expression   Required. An expression that returns an HTMLProject object.

Example

As it applies to the CommandBarButton object.

This example creates a command bar named Custom and adds two blank buttons to it. The example then sets the button on the left to msoButtonUp and sets the button on the right to msoButtonDown.

Set myBar = CommandBars _
    .Add(Name:="Custom", Position:=msoBarTop, _
    Temporary:=True)
With myBar
    .Controls.Add Type:=msoControlButton, ID:=1
    .Controls.Add Type:=msoControlButton, ID:=2
    .Visible = True
End With
Set myControl1 = CommandBars("Custom").Controls(1)
myControl1.State = msoButtonUp
Set myControl2 = CommandBars("Custom").Controls(2)
myControl2.State = msoButtonDown