Move Method

Microsoft Office Object Model

Show All

Move Method

       

Some of the content in this topic may not be applicable to some languages.

Move method as it applies to the CommandBarButton, CommandBarComboBox, CommandBarControl, and CommandBarPopup objects.

Moves the specified command bar control to an existing command bar.

expression.Move(Bar, Before)

expression   Required. An expression that returns one of the above objects.

Bar  Optional Variant. A CommandBar object that represents the destination command bar for the control. If this argument is omitted, the control is moved to the end of the command bar where the control currently resides.

Before  Optional Variant. A number that indicates the position for the control. The control is inserted before the control currently occupying this position. If this argument is omitted, the control is inserted on the same command bar.

Move method as it applies to the Assistant object.

Moves the Office Assistant to the specified location.

expression.Move(xLeft, yTop)

expression   Required. An expression that returns an Assistant object.

xLeft  Required Integer. The left position of the Office Assistant window, in points.

yTop  Required Integer. The top position of the Office Assistant window, in points.

Example

As it applies to the CommandBarButton, CommandBarComboBox, CommandBarControl, and CommandBarPopup objects.

This example moves the first combo box control on the command bar named Custom to the position before the seventh control on that command bar. The example sets the tag to "Selection box" and assigns the control a low priority so that it will likely be dropped from the command bar if all the controls don't fit in one row.

Set allcontrols = CommandBars("Custom").Controls
For Each ctrl In allControls
    If ctrl.Type = msoControlComboBox Then
        With ctrl
            .Move Before:=7
             .Tag = "Selection box"
             .Priority = 5
         End With
         Exit For
    End If
Next

As it applies to the Assistant object.

This example displays the Office Assistant in the specified location and sets several options before making it visible.

With Assistant
    .Reduced = True
    .Move xLeft:= 400, yTop:= 300
    .MoveWhenInTheWay = True
    .TipOfDay = True
    .Visible = True
    .Animation = msoAnimationGreeting
End With