Hi, I have been working with some code that takes the text from text3 places it in the name column and indents the relevent tasks by one level.
Thanks to PDQBach for getting me this far.
============================================================================================
Sub WOHeaderIndent()
Dim boolAllDone As Boolean
Dim lngTask As Long
Dim strSaveText3 As String
Application.Calculation = False
SelectTaskField row:=1, Column:="Name", rowrelative:=False
EditInsert
SetTaskField Field:="Name", Value:="Updated"
lngTask = ActiveProject.Tasks.Count
strSaveText3 = ActiveProject.Tasks(lngTask).Text3
boolAllDone = False
Do
If ActiveProject.Tasks(lngTask).Text3 = strSaveText3 Then
ActiveProject.Tasks(lngTask).OutlineLevel = 2
lngTask = lngTask - 1
Else
SelectTaskField row:=lngTask + 1, Column:="Name", rowrelative:=False
EditInsert
SetTaskField Field:="Name", Value:=strSaveText3
SetTaskField Field:="Outline Level", Value:=1
SetTaskField Field:="Text3", Value:=strSaveText3
strSaveText3 = ActiveProject.Tasks(lngTask).Text3
End If
Loop Until lngTask = 1
SelectTaskField row:=1, Column:="Name", rowrelative:=False
SetTaskField Field:="Text3", Value:=strSaveText3
Application.Calculation = True
End Sub
=========================================================================================
What I would like to do is only indent the tasks where Text 26 = "NEW"
I have tried unsuccesfully to use if then. Can someone show me please how to limit the indenting to only tasks that comply with text 26 equaling "NEW"
Thanks
Thanks to PDQBach for getting me this far.
============================================================================================
Sub WOHeaderIndent()
Dim boolAllDone As Boolean
Dim lngTask As Long
Dim strSaveText3 As String
Application.Calculation = False
SelectTaskField row:=1, Column:="Name", rowrelative:=False
EditInsert
SetTaskField Field:="Name", Value:="Updated"
lngTask = ActiveProject.Tasks.Count
strSaveText3 = ActiveProject.Tasks(lngTask).Text3
boolAllDone = False
Do
If ActiveProject.Tasks(lngTask).Text3 = strSaveText3 Then
ActiveProject.Tasks(lngTask).OutlineLevel = 2
lngTask = lngTask - 1
Else
SelectTaskField row:=lngTask + 1, Column:="Name", rowrelative:=False
EditInsert
SetTaskField Field:="Name", Value:=strSaveText3
SetTaskField Field:="Outline Level", Value:=1
SetTaskField Field:="Text3", Value:=strSaveText3
strSaveText3 = ActiveProject.Tasks(lngTask).Text3
End If
Loop Until lngTask = 1
SelectTaskField row:=1, Column:="Name", rowrelative:=False
SetTaskField Field:="Text3", Value:=strSaveText3
Application.Calculation = True
End Sub
=========================================================================================
What I would like to do is only indent the tasks where Text 26 = "NEW"
I have tried unsuccesfully to use if then. Can someone show me please how to limit the indenting to only tasks that comply with text 26 equaling "NEW"
Thanks