Consolidate w/ VB.Net and Project 2002

M

Michael

I'm trying to open a template file, then loop through a set of directories and use ConsolidateProject to add them to the template file. I seem to be able to to that fine, but when I use FileSaveAs on the template, MSProject crashes and I cant save. I also need to be able to read in some BuiltInDocumentProperties from each project added and save the value in Text1, Text2, etc. Any help would be appreciated. Here's what I'm doing in my code: (referencing Interop.MSProject.DLL

Dim msp As New MSProject.Applicatio
Dim project As New MSProject.Applicatio
msp.DisplayAlerts = Fals

msp.FileOpen("c:\documents and settings\pacifim\desktop\reporting\ConRep.mpt"
msp.ConsolidateProjects("c:\documents and settings\pacifim\desktop\reporting\project1\00 project planning.mpp", , False
msp.ConsolidateProjects("c:\documents and settings\pacifim\desktop\reporting\project2\00 project planning.mpp", , False
msp.FileSaveAs("c:\documents and settings\pacifim\desktop\reporting\report1.mpp"

msp.FileCloseAll(
msp.DisplayAlerts = Tru
msp.FileSaveAs("c:\documents and settings\pacifim\desktop\reporting\MovConSol.mpp", PjFileFormat.pjMPP, , , , , , , , , , , , , , , , ,
msp.FileCloseAll(
 
R

Rod Gill

Hi,

What happens when you consolidate the same number of files manually and then
use File, Save AS?

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
Michael said:
I'm trying to open a template file, then loop through a set of directories
and use ConsolidateProject to add them to the template file. I seem to be
able to to that fine, but when I use FileSaveAs on the template, MSProject
crashes and I cant save. I also need to be able to read in some
BuiltInDocumentProperties from each project added and save the value in
Text1, Text2, etc. Any help would be appreciated. Here's what I'm doing in
my code: (referencing Interop.MSProject.DLL)
Dim msp As New MSProject.Application
Dim project As New MSProject.Application
msp.DisplayAlerts = False

msp.FileOpen("c:\documents and settings\pacifim\desktop\reporting\ConRep.mpt")
msp.ConsolidateProjects("c:\documents and
settings\pacifim\desktop\reporting\project1\00 project planning.mpp", ,
False)
msp.ConsolidateProjects("c:\documents and
settings\pacifim\desktop\reporting\project2\00 project planning.mpp", ,
False)
msp.FileSaveAs("c:\documents and settings\pacifim\desktop\reporting\report1.mpp")

msp.FileCloseAll()
msp.DisplayAlerts = True
msp.FileSaveAs("c:\documents and
settings\pacifim\desktop\reporting\MovConSol.mpp", PjFileFormat.pjMPP, , , ,
, , , , , , , , , , , , , )
 
M

Michael

Rod

When I do that, it works fine. Seems like it's the interop/com dll causing the problem. Unfortunately, there are about 100 mpp files that need to be consolidated so I can't recommend the manual route. I'm thinking I might need to go to the project macro route, but I would prefer to do this in VB.Net

Thanks
Michael
 

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