I have a program that analyzes the logical structure of a project schedule and captures the Task IDs (not UniqueID) of tasks that need to be corrected. Is there a way to call the task dialogue form with the task ID?
The following code works, but it requires showing all tasks in the Gantt chart view and then displaying the row.
Private Sub TaskList_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
'
' Title: TaskList_DblClick
' Author: 12/05/2023 by Gary E. Didio
' Purpose: Displays the selected item in MS Project dialogue
'
Dim tItem As String
'
' Get the full text of the item as displayed
'
tItem = TaskList.List(TaskList.ListIndex)
'
' Process tasks and resources with separate dialogues
'
If Left(tItem, 1) = "T" Then
'
' Change to Gantt chart view and show all tasks
'
ViewApplyEx Name:="&Gantt Chart", ApplyTo:=0
SummaryTasksShow True
FilterApply "All Tasks"
SelectAll
OutlineShowAllTasks
SelectBeginning
'
' Delete the task designator "Task:", then display the task dialogue
'
tItem = Right(tItem, Len(tItem) - 5)
ViewApplyEx Name:="&Gantt Chart", ApplyTo:=0
SelectTaskField row:=GetItem(tItem), Column:="Name", RowRelative:=False
InformationDialog
Else
'
' Delete the resource designator "Resource:", then display the resource dialogue
'
tItem = Right(tItem, Len(tItem) - 9)
ViewApplyEx Name:="Resource &sheet", ApplyTo:=0
SelectResourceField row:=GetItem(tItem), Column:="Name", RowRelative:=False
InformationDialog
End If
End Sub