I'm trying to set an outline level in MS Project using a VBA Code.
I have all the information in MSProject, and would like to set the column "Outline Level" column, based on The value in "Text 1" column>
I am not able to set the types of columns, as these are preset by Project.
I have tried to copy and paste, manually the values from Text 1 into Outline Level, but project won't allow it, so I'd like to do an If/Then statement, to enter the values. If Text 1 is a 1, then Outline Level is a 1, etc. I'd like to enter each value in Outline Level, then go to the next row and do the same, until each Outline Level has been entered in.
Sub OutLineLevel()
Set projApp = ActiveProject
Dim OutlineLevel As Long
Dim Text1 As Long
Dim i As Long
For i = 1 To 4
If projApp.Text1(i, 0) = 1 Then
projApp.OutlineLevel(i, 0) = 1
ElseIf projApp.Text1(i, 0) = 2 Then
projApp.OutlineLevel(i, 0) = 2
ElseIf projApp.Text1(i, 0) = 3 Then
projApp.OutlineLevel(i, 0) = 3
ElseIf projApp.Text1(i, 0) = 4 Then
projApp.OutlineLevel(i, 0) = 4
Else: projApp.Text1(i, 0) = 5
End If
Next i
End Sub
I'm getting "Property Not Defined" at the first "If" statement