How can you access hidden published ms-project .mpp files

237 views Asked by At

I was writing a simple script in VBA for batch updating project info posted on Project Web App. I've stumbled on a problem which seems unsolvable to me though, opening projects programatically through FileOpenEx method is working only on a fraction of them.

I found out when opening files manually through MS Project's file explorer that most of the projects are hidden until you pick "Show list of all projects" option, which appears on the top of the list of .mpp files to choose from. After picking this option, all projects unavailable to open through macro show up after a few seconds of loading.

I have no clue on how to tackle this problem, maybe connecting to the SharePoint database in a different, more direct way would help? I'm posting below a few lines of code responsible for opening the projects.

    Dim myMPP As MSProject.Application
    Set myMPP = CreateObject("Msproject.Application")
    myMPP.Visible = True
    
    Dim projectName, fpath As String
    projectName = "ExampleProject"
    fpath = "<>\" & projectName
    myMPP.FileOpenEx Name:=fpath, ReadOnly:=True, openPool:=pjDoNotOpenPool
    Set mpp = myMPP.ActiveProject
1

There are 1 answers

0
Ryszard Andrzejewski On

Solution to the problem was opening MS Project manually before running any macros. Instances of Project opened programatically seem to be able to operate only on cached projects.