Show selected summaries and subtasks
I want to create a macro to show summaries and subtasks based on a string input. Here is the sample code. When it finds the string, it shows all subtasks, but not the summary task. Please help -
Public Sub ShowSum() 'Show selected summary
Dim vTask As Task, vString As String
GetString:
vString = InputBox("Enter a string to search ...", "Show Summary")
If vString = "" Then Exit Sub
Preparation:
SelectBeginning
OutlineHideSubTasks 'hide all tasks
ShowSummariesIfFound:
For Each vTask In ActiveProject.Tasks
Select Case True
Case vTask Is Nothing
Case Not vTask.Summary
Case InStr(UCase(vTask.Name), UCase(vString)) 'find string
Debug.Print vTask.ID, vTask.WBS, vTask.Name
vTask.OutlineShowSubTasks
Case vTask.PercentComplete = 100 'task completed
Debug.Print vTask.ID, vTask.WBS, vTask.Name
vTask.OutlineHideSubTasks
Case Else
End Select
Next vTask
SelectBeginning
End Sub
Andre
|