Task Object

Description

Represents a single task running on the system. The Task object is a member of the Tasks collection. The Tasks collection includes all the applications that are currently running on the system.

Using the Task Object

Use Tasks(index), where index is the application name or the index number, to return a single Task object. The following example switches to and resizes the application window for the first visible task in the Tasks collection.

With Tasks(1)
    If .Visible = True Then
        .Activate
        .Width = 400
        .Height = 200
    End If
End With
The following example restores the Calculator application window if Calculator is in the Tasks collection.

If Tasks.Exists("Calculator") = True Then
    Tasks("Calculator").WindowState = wdWindowStateNormal
End If
Use the Shell function to run an executable program and add the program to the Tasks collection.

Properties

Application property, Creator property, Height property, Left property, Name property, Parent property, Top property, Visible property, Width property, WindowState property.

Methods

Activate method, Close method, Move method, Resize method, SendWindowMessage method.