Consulting

Results 1 to 3 of 3

Thread: Read all rows in combined Project file

  1. #1
    VBAX Newbie
    Joined
    Jan 2011
    Posts
    2
    Location

    Read all rows in combined Project file

    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

  2. #2
    VBAX Newbie
    Joined
    Jan 2011
    Posts
    2
    Location
    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

  3. #3
    VBAX Regular
    Joined
    Feb 2011
    Posts
    13
    Location
    Quote Originally Posted by lepton
    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...

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •