Iterate thru project files

S

Scott

Hi, does anyone know how to iterate thru project files on project server.
I'm using the following code, and i have a bunch of projects, and new ones
are added frequently. So i want to iterate through them without specifying
each project name. Thanks. Scott


Dim pApp As Microsoft.Office.Interop.MSProject.Application

Dim app As Application

pApp = CreateObject("msproject.application")

pApp.Visible = True


pApp.FileOpen(Name:="<>\a.Published", readonly:=True)
If System.IO.File.Exists("\\Pegasus\AllAccess\Project
Management\a.mpp") Then
System.IO.File.Delete("\\Pegasus\AllAccess\Project
Management\a.mpp")
End If
pApp.FileSaveAs(Name:="\\Pegasus\AllAccess\Project
Management\a.mpp", FormatID:="MSProject.MPP")
pApp.FileClose()
 
J

Jack Dahlgren

I've done something like this but used an excel list of projects so I could
keep a log of what was opened and easily just open a sub-set of projects.

I think it should be possible to use a PSI call to grab a list of the
projects or if you are using Proj 2007 you may be able to create a master
project with all the subprojects and then from that master project I think
you can grab all the subproject names and open them.

-Jack Dahlgren
 
R

Rod Gill

In 2003 I read the MSP_VIEW_Projects table and in 2007 the
msp_ProjectsUserview View in the Reporting db. I use oledb to read directly
from SQL Server then iterate through the recordset and use the Project name
to open each project in turn. Plenty of examples in MSDN of using oledb to
read data from SQL Server.

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top