Class Task (Word VBA)
The class Task 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.
Dim tsk as Task
Set tsk = Tasks(Index:=1)
For Each
Here is an example of processing the Task items in a collection.
For Each tsk In Tasks
If InStr(tsk.Name, "Microsoft Excel") > 0 Then
tsk.Activate
tsk.Close
End If
Next tsk
Methods
Activate - Activates the Task object.
Close - Closes the specified task.
Move - Positions a task window.
Resize - Sizes the specified task window.
SendWindowMessage - Sends a Windows message and its associated parameters to the specified task.
Properties
Name (Default member) - Returns the name of the specified object.
Height returns or sets the height of the specified task window.
Left returns or sets a Long that represents the horizontal position of the specified task, measured in points.
Top returns or sets the vertical position, in points, of the specified window.
Visible true if the specified object is visible.
Width returns or sets the width of the specified Task object, in points.
WindowState returns or sets the state of the specified document window or task window.