I would like to indent tasks on import from Excel. I have working solution for importing tasks, however I can't find a solution for indenting tasks in MS Project without adding something to text name, like:
If (Not IsEmpty(Range("AJ" & i).Value)) And (Not IsError(Range("AJ" & i).Value)) Then
Select Case Left(newproj.Tasks(i - 7).Name, 3)
Case "( ", "Op-"
newproj.Tasks(i - 7).OutlineIndent
End Select
End If
This is OK, but does not look nice when there is something like "Op-" in front of task name. Is it possible to Indent while importing?
Here is my code for importing tasks:
For i = 8 To 90
strValue = Worksheets("Timeschedule").Range("AK" & i)
If (Not IsEmpty(Range("AK" & i).Value)) And (Not IsError(Range("AK" & i).Value)) Then
newproj.Tasks.Add strValue
End If
Next i
My tasks in Excel are in column AK, in helper column AJ there are Op- values to identify what should be indented and what not.
I have found solution with using OutlineLevel
. If somebody is interested in code, it is here:
If (Range("AK" & i).Value <> "") And (Not IsError(Range("AK" & i).Value)) Then
newproj.Tasks.Add strValue
Select Case Range("AJ" & i).Value
Case "Op-"
newproj.Tasks(i - 7).OutlineLevel = 2
Case "As-"
newproj.Tasks(i - 7).OutlineLevel = 1
End Select
End If