Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Master Project & sub Project Macro Error : Argument Value is not Valid

$
0
0

Hi,

What is wrong with this Code???

I have a Master Project and Some Sub Projects, and I am suppose to loop through it in reverse direction... But i am getting an error on the Highlighted Line "Argument value is not valid"

Here ActiveProject. Tasks.Count shows =40 Tasks But when i loop through the For each t in activeproject.Tasks it shows 2857 Tasks and when i loop in the reverse direction it throws an error

Sub test()
Dim t As Task
Dim i As Integer
Dim icnt As Long
Debug.Print CStr(ActiveProject.Tasks.Count)
For Each t In ActiveProject.Tasks
    Debug.Print "OLD" & "-->" & t.Name
    i = i + 1
Next t
For icnt = i To 1 Step -1
    Debug.Print "New" & "-->" & ActiveProject.Tasks(icnt).Name
Next icnt
End Sub


Thanks, Parth



Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>