PDA

View Full Version : Read all rows in combined Project file



lepton
01-12-2011, 09:30 PM
Hi all,

I like to develop a macro which reads all rows of a MS Project files which contains references to other MS Project files. The reason is that I do have a big schedule which is composed of 6 sub-schedules (ms project files) which the project managers change independently.

I do have:
- 1x master file
(containing project management functions and references to other MS project files which can be opened by expanding them in the master file)
- 6x sub schedules

The macro is part of the master file.

The problem:
'does return only the tasks of the master file
Set taskList = ActiveProject.Task

Does somebody have an idea how I can read the tasks of the referenced files as well? Do I have to manually open them? If yes, how can I do that and can I get all tasks in one list to be able to go through them with a for loop?

Many thanks in advance!
Lep

lepton
01-13-2011, 06:51 PM
Hi again,

the macro is running perfectly for on MS Project file. How can I just read the tasks of another MS Project file? FileOpen seems not to be an option. Is it possible to read a Project file without opening it?

Thank you and regards,
Lep

draco664
02-24-2011, 06:47 PM
The problem:
'does return only the tasks of the master file
Set taskList = ActiveProject.Task

Does somebody have an idea how I can read the tasks of the referenced files as well? Do I have to manually open them? If yes, how can I do that and can I get all tasks in one list to be able to go through them with a for loop?

Many thanks in advance!
Lep

Hi Lep,

I only just joined the site, so my response is a bit on the late side... :hi:

As you noted, you are only getting the tasks from the master schedule. That is because the .Tasks property doesn't include the tasks from each of the subprojects in the master project.

Here's a little code snippet that will cycle through each task in each subproject.

Sub ScanSubprojectTasks()
Dim aTsk As Task

For i = 1 To ActiveProject.Subprojects.Count
For Each aTsk In ActiveProject.Subprojects(i).SourceProject.Tasks
If Not aTsk Is Nothing Then
Application.StatusBar = "Task " & aTsk.ID & " of " & _
ActiveProject.Subprojects(i).SourceProject.Tasks.Count
End If
Next aTsk
Next i

End Sub


Good luck!

Chris