How to Instantiate an existing project in VB.net

J

JimS

I want to open up and interogate an existing MSP project (NOT server) using
VB.net. I have finally found the correct reference and import statements. How
do I instantiate my "project" object and point it to an existing project? So
far, I've got:

dim XYZ as new Project
dim tsk as Task
....

Now, I'm stuck.

Can anyone point me the right way to start up. After that, I'll be good.
Thanx
 
R

Rod Gill

Sub Test()
Dim prjApp As MSProject.Application
Dim Proj As MSProject.Project

Try
prjapp = getobject(, "MSProject.Application")
proj = prjapp.activeproject
msgbox(proj.tasks(1).name)
Catch ex As Exception
MsgBox("Couldn't connect")
Finally
prjApp = Nothing
End Try


End Sub

Code requires project be open and a proejct with a task in it open.
 
J

JimS

Thank you, Rod. I appreciate your help.

Is it not possible to use the project without having MSP open? I'm fully
licensed and loaded, just don't want to have to have it open at the same time
(though it's only a little inconvenience...)

Again, Rod, thank you for your help!
 
R

Rod Gill

You can read (but not write) data directly from .mpp files using oledb. See
the pjoledb.htm file in one of Project's program folders. Note that this
functionality will not be supported in Project 2007 which is a shame because
it's a great way of reading data fast without needing to open projects or
save them in a database.
 

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