BuiltInDocumentProperties

K

Klem

I am trying to open a template project from SQL Server,
modify the title, author, and company properties, and
then save it back to SQL under a different name. The
following is the code I have been working with:

Dim vstTemp1 As String = ""
Dim vobAppProject As New MSProject.Application
With vobAppProject
.FileOpen("<InCProjectDB>\InC Project
Template")
.Visible = True
vstTemp1 = "<IncProjectDB>\test"
.FileSaveAs
(vstTemp1, , , , , , , , , "MSProject.odbc")
'.ActiveProject.BuiltinDocumentProperties
("Author") = "JDK"
.ActiveProject.Author = "JDK"
'.ProjectSummaryInfo
(.ActiveProject, "Title", , "JDK", "company", , , , , , ,
, , , , )
'.FileSave()
.FileClose(MSProject.PjSaveType.pjSave)
.Quit()
End With

If I step thru the code and check it as I go, all of the
property info gets modified properly. However, when I
reopen the project only the title information was saved.
The author and company info revert back to what they were
when I first opened the template. If after I let the
code modify the properties, I manually open the
File|Properties, click OK, and then let the code finish,
then everything gets saved properly.

What am I doing wrong?

I am running this code in VB.NET.

Thanks,

Klem
 
R

Rod Gill

Hi,

I would copy and run this code in Project VBA. If it works there then you
know there is a VB.Net problem. If it doesn't work, then Project VBA is the
problem. I think it's time to determine what the problem isn't rather than
what it is.

--
Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 

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