Append Project To MPD Database

R

Rod Gill

If the code in the second example is Project2 not project1 what happens?

Try recording code in Project of you saving two projects to the same .mpd
file and see what the difference is.

--
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/
 
R

Ross Herbert

Hi,

I have a real problem with Creating a Project and saving it to an .MPD
Project Database. I am using VBA Automation from Access 2000 to Project
2002 Pro.

Basically, the following code in MSProject saves and APPENDS a project to a
database:

displayalerts=false
filesaveas name:="<mydatabase.mpd>\project1", formatid:="MSProject.mpd"

However, the same code, and variations of it, OVERWRITES the database when
called from Access:

dim app as new msproject.application
....
....create project...
....
app.displayalerts=false
app.filesaveas name:="<mydatabase.mpd>\project1", formatid:="MSProject.mpd"

No matter what I do, the displayalerts command doesn't appear to do
anything, and the database is always overwritten. This didn't happen in
Project 2000, and doesn't happen in Project 2002 if using VBA code
internally (not through automation).

I'm really stuck. Does anybody have any solutions? I need to save to a
database and I can't find any solutions on the web.

Thanks in advance.

Ross.
 
R

Ross Herbert

Hi Rod, thanks for the reply,

If the filename to be saved is "Project2" in the second example (or any name
in fact), it overwrites the database rather than appending to it.

As you requested, I recorded a macro in Project which saves two files to the
same database. It runs perfectly. I copy and pasted the code directly into
an Access routine with the only additional entries being:

dim app as new msproject.application
with app
....
....
end with

I also modified the project code with a "." prefix so it knew it was
relating to the app variable. When I run the code it overwrites the
database each time a save occurs.

And, if I forget to close a project before saving another one I get the very
telling message of:
"The file [blah blah] cannot be deleted because it is open or being used by
another program"

All very strange. I have tried the same thing on two computers, one using
Access 2000 and Win 2000, and the other Access 2002 and Win XP. Both have
Project 2002 professional, and I have even installed Project Service Pack 1.

What do you think?

Regards, Ross


----- Original Message -----
 

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