Results 1 to 15 of 15

Thread: VBA to use all projects in folder as subprojects

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    VBAX Regular
    Joined
    Dec 2015
    Posts
    11
    Location
    So I tried the code in Post #6 last night. But I didn't share the results. I get the following error: Object doesn't support this property or method.

    I have Project 2010, so the methods in Post #11 aren't available per se. The first one, I can't figure out an alternate (there is no "Window" menu, and when I open a new Project, I don't see a Projects list anywhere, unless I go to File>Recent. But that just allows me to go to one of the open projects, not select any of them.

    There is no insert menu, but from what I understand, this was replaced in 2010 with the Subprojects on the Projects tab.This is what I've been using to figure things out so far. Here is what it comes up with.

    Here's what happens when I Ctrl+A to select all files in folder to insert as subprojects:

    Sub Macro6()
    ' Macro Macro6
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150203.mpp,C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150175.mpp,C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150181.mpp,C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150014.mpp,C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150025.mpp,C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150171.mpp", NewWindow:=False, HideSubtasks:=True
    End Sub

    Here's what hapens when I select one project at a time to insert:

    Sub Macro8()
    ' Macro Macro8
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150146.mpp", NewWindow:=False, HideSubtasks:=True
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150038.mpp", NewWindow:=False, HideSubtasks:=True
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-160013.mpp", NewWindow:=False, HideSubtasks:=True
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150183.mpp", NewWindow:=False, HideSubtasks:=True
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150163.mpp", NewWindow:=False, HideSubtasks:=True
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150158.mpp", NewWindow:=False, HideSubtasks:=True
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150106.mpp", NewWindow:=False, HideSubtasks:=True
    End Sub
    That method inserts subprojects in the first row and just moves al the prior inserted projects down. So here's the last method, which moves to the next row after each insertion("Indicators" is just the first column - in Excel it would correspond to the "A" in "A1"):

    Sub Macro10()
    ' Macro Macro10
        SelectTaskField Row:=1, Column:="Indicators", RowRelative:=False
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150014.mpp", NewWindow:=False, HideSubtasks:=True
        SelectTaskField Row:=2, Column:="Indicators", RowRelative:=False
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150025.mpp", NewWindow:=False, HideSubtasks:=True
        SelectTaskField Row:=3, Column:="Indicators", RowRelative:=False
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150038.mpp", NewWindow:=False, HideSubtasks:=True
        SelectTaskField Row:=4, Column:="Indicators", RowRelative:=False
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150106.mpp", NewWindow:=False, HideSubtasks:=True
        SelectTaskField Row:=5, Column:="Indicators", RowRelative:=False
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150146.mpp", NewWindow:=False, HideSubtasks:=True
        SelectTaskField Row:=6, Column:="Indicators", RowRelative:=False
        ConsolidateProjects Filenames:="C:\Users\isaacc\Documents\Schedules\Open_Jobs\IRC-150158.mpp", NewWindow:=False, HideSubtasks:=True
    End Sub
    Last edited by SamT; 02-06-2016 at 08:54 AM.

Posting Permissions

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