Application.ActiveSelection property (Project)
Gets a Selection object that represents the active selection. Read-only Selection.
Syntax
expression. ActiveSelection
expression A variable that represents an Application object.
Example
The following example displays the name of each selected task in a message box. Running this example without a valid selection results in a trappable error (error code 424).
Sub SelectedTasks()
Dim T As Task
If Not (ActiveSelection.Tasks Is Nothing) Then
For Each T In ActiveSelection.Tasks
' Test for blank task row
If Not (T Is Nothing) Then
MsgBox T.Name
End If
Next T
End If
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.