Move Method

Applies To

Assistant object, CommandBarButton object, CommandBarComboBox object, CommandBarControl object, CommandBarPopup object.

Description

CommandBarControl object: Moves the specified command bar control to an existing command bar.

Assistant object: Moves the Office Assistant to the specified location.

Syntax 1

expression.Move(Bar, Before)

Syntax 2

expression.Move(xLeft, yTop)

expression Syntax 1: Required. An expression that returns a CommandBarControl, CommandBarButton, CommandBarPopup, or CommandBarComboBox object.

Syntax 2: Required. An expression that returns an Assistant object.

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 same command bar (the command bar that the control currently resides on).

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.

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

This example moves the first combo box control from the custom 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
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