Task.Activate Method

Word Developer Reference

Activates the Task object.

Syntax

expression.Activate(Wait)

expression   Required. A variable that represents a Task object.

Parameters

Name Required/Optional Data Type Description
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.

Return Value

Example

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

Visual Basic for Applications
  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.<strong class="bterm">Activate</strong>
        Task1.WindowState = wdWindowStateNormal
    End If
Next Task1

End Sub

See Also