Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS Project data via Visual Basic

Posted on 2002-07-07
6
Medium Priority
?
901 Views
Last Modified: 2012-05-04
I'm expert at using Visual Basic to get MS Project data out of an MS Access file once the project is saved in MDB format, but now I'm trying to use VB to go directly to the project file.

I'm getting lots of stuff just fine (tasks, resources, etc.), but one thing I can't get is the project info.  This is the stuff that in project you get by going to file >> properties >> summary

There is a VB function for the project object:

Function ProjectSummaryInfo([Project], [Title], [Subject], _
            [Author], [Company], [Manager], [Keywords], [Comments], _
            [Start], [Finish], [ScheduleFrom], [CurrentDate], [Calendar], _
            [StatusDate], [Priority]) As Boolean

that works great to SET any of the listed values, but what I can't figure out is how do you GET the values.  I know where they are in the MDB file, but can't find them in the MPP file itself.

any suggestions?


0
Comment
Question by:HobbitHouse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 1200 total points
ID: 7135090
Hi HobbitHouse,

to get this to work you've got to use late binding, don't ask me why


Public Sub GetDocProps()
     Dim pjApp As Object
     Dim pj As Object
     Dim pjDocProps As Object
     
     Set pjApp = CreateObject("MSProject.Application")
     pjApp.FileOpen ("l:\sf command center\sf command center.mpp")
     Set pj = pjApp.ActiveProject
         
     Dim i As Integer
     i = 1
     On Error GoTo errhandle
     Debug.Print "Builtin"
     For i = 1 To pj.BuiltinDocumentProperties.Count
       Debug.Print pj.BuiltinDocumentProperties(i).Name & " :" & pj.BuiltinDocumentProperties(i).Value
       i = i + 1
     Next
     MsgBox "This is the title :" & pj.BuiltinDocumentProperties("Title").Value
     Debug.Print "Custom"
     For i = 1 To pj.CustomDocumentProperties.Count
       Debug.Print pj.CustomDocumentProperties(i).Name & " :" & pj.CustomDocumentProperties(i).Value
       i = i + 1
     Next
     MsgBox "This is the title :" & pj.CustomDocumentProperties("Start").Value
     Exit Sub
errhandle:
     Resume Next
End Sub

just a sample to play with and maybe you get an idea from it

HAGD:O)Bruintje
0
 
LVL 7

Expert Comment

by:ildc
ID: 7135118
set pj = pjapp.activeproject ??

Don't really follow this one bruintje.

Regards
0
 
LVL 7

Expert Comment

by:ildc
ID: 7135123
OOPS, wrong glasses... sorry :(
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:HobbitHouse
ID: 7135855
Brian,

That's cool

I found another way to do it (and it doesn't require late binding and works well with my other code, which yours doesn't because of the late binding), BUT your response was prompt and teaches me something new, so I'll happily give you the points & my thanks.

a related question that you might be able to help with:  The reason I couldn't find it right away is that my object browser help doesn't work for MS Project & I'm wondering if yours does. I assume that generally it does and that mine is on the fritz & needs to be reinstalled.  So that's my question, really --- does your object browswer work for MS Project?  That is, if you go to Object Browser >> MS Project >> application >> active cell (just to pick one of the first things that comes up) and you then click on the help icon, do you get help?  I don't --- all I get is a msg box saying  "unable to display help"

my solution, by the way, just uses, for example

Dim proj As MSProject.Application
Set proj = New MSProject.Application
proj.FileOpen Name:="e:\adev\vb\ms project play\P_DA.mpp"
msgbox proj.ActiveProject.Author
0
 

Author Comment

by:HobbitHouse
ID: 7135857
Brian,

That's cool

I found another way to do it (and it doesn't require late binding and works well with my other code, which yours doesn't because of the late binding), BUT your response was prompt and teaches me something new, so I'll happily give you the points & my thanks.

a related question that you might be able to help with:  The reason I couldn't find it right away is that my object browser help doesn't work for MS Project & I'm wondering if yours does. I assume that generally it does and that mine is on the fritz & needs to be reinstalled.  So that's my question, really --- does your object browswer work for MS Project?  That is, if you go to Object Browser >> MS Project >> application >> active cell (just to pick one of the first things that comes up) and you then click on the help icon, do you get help?  I don't --- all I get is a msg box saying  "unable to display help"

my solution, by the way, just uses, for example

Dim proj As MSProject.Application
Set proj = New MSProject.Application
proj.FileOpen Name:="e:\adev\vb\ms project play\P_DA.mpp"
msgbox proj.ActiveProject.Author
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7135896
Wow, thanks for the points and glad you got it solved though in a different way but that seems inherent to the work we do ;)

the browser is working here, all of the entries and even the F1-help on them

but it's not working as you get in the rest of office like context sensitive it seems, you got to look it up, i got only project 2000 installed here especially for EE questions so i don't look into it that much

the help is popping but not with help about the vba properties and methods on the object

aha, i haven't installed context help for VBA, so it asks for the CD, and after that it worked. seems a bit strange i could look up some vba help in the normal helpfile anyway

to make a long story short, it worked after installing ;)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question