Share via


Activate Method

Activate method as it applies to the Application, Document, InlineShape, OLEFormat, Pane, Shape, ShapeRange, and Window objects.

Activates the specified object.

expression.Activate

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

Activate method as it applies to the Task object.

Activates the Task object.

expression.Activate(Wait)

expression Required. An expression that returns a Task object.

Wait   Optional Variant. True to wait until the user has activated Word before activating the task. False to immediately activate the task, even if Word isn't active.

Example

As it applies to the Document object.

This example activates the document named "Sales.doc."

Sub OpenSales()
   'Sales.doc must exist and be open but not active.
   Documents("Sales.doc").Activate
End Sub

As it applies to the Window object.

This example activates the next window in the Windows collection.

Sub NextWindow()
    'Two or more documents must be open for this statement to execute.
    ActiveDocument.ActiveWindow.Next.Activate
End Sub

As it applies to the Task object.

This example activates the Notepad application if Notepad is in the Tasks collection.

Sub ActivateNotePad()
    Dim Task1    'Notepad must be open and in the Task List.

    For Each Task1 In Tasks
        If InStr(Task1.Name, "Notepad") > 0 Then
            Task1.Activate
            Task1.WindowState = wdWindowStateNormal
        End If
    Next Task1
End Sub

As it applies to the Pane object.

This example splits the active window and then activates the first pane.

Sub SplitWindow()
With ActiveDocument.ActiveWindow
    .SplitVertical = 50
    .Panes(1).Activate
 End With
End Sub

Applies to | Application Object | Document Object | InlineShape Object | OLEFormat Object | Pane Object | Shape Object | ShapeRange Collection Object | Task Object | Window Object

See Also | ActivateAs Method | Active Property | ActiveDocument Property | ActivePane Property | ActivePrinter Property | ActiveWindow Property | Arrange Method | Select Method | SendWindowMessage Method | WindowState Property