I'm not familiar with Project 2000 but I've never been able to do that with Project 98. Now, there are work-arounds if you want. 1) You can save Project tables as tables in Access and then get the information. 2) You could open a recordset then open project and iterate through the tabledata while filling in the recordset. 3) You could open Project with automation and read through all the table data. Too bad you can't do it though, I would be able to use it a lot easier.
Microsoft used to send out a copy of their 'Microsoft Project 98 Visual Basic Environment' document upon request and they also had it on their web support site for a while. There is no index but there are quite a few examples of what you can do. I believe I have a electronic copy if you want.
Steve King Growth follows a healthy professional curiosity
Option 2 looks best, but I am not sure how I would "get hold" of the data in the Project. Any sample code to point me int the righ direction?
Unfortunately, all my code goes the other way. I build an MPX file which is then opened by Project and can be saved as a native MPP file.
Use this as a sample. It merely prints the task names, duration, and start date. Remember you will need to set Microsoft Project as a reference.
Public Sub Proj()
Dim oProj As Object
Dim oTsk As Task
Dim MyAppID As Long
Set oProj = GetObject("f:\groups\sdv\dmats\scking\mpx\CPSG_MAFC_SCHEDULE_0199.MPX", "MSProject.Project"
If Err <> 0 Then
MyAppID = Shell("C:\Program Files\Microsoft Office\Office\WINPROJ.EXE", 1) ' Run Microsoft Word.
'AppActivate MyAppID ' Activate Microsoft
Set oProj = GetObject("f:\groups\sdv\dmats\scking\mpx\CPSG_MAFC_SCHEDULE_0199.MPX", "MSProject.Project"
End If
oProj.FileOpen Name:="f:\groups\sdv\dmats\scking\mpx\CPSG_MAFC_SCHEDULE_0199.MPX"
For Each oTsk In oProj.Tasks
Debug.Print oTsk.Name, oTsk.Duration, oTsk.Start
Next oTsk
End Sub
Steve King Growth follows a healthy professional curiosity
The "Remember you will need to set Microsoft Project as a reference" bit was the key - it is always the simplest things that causes the greatest loss of hair!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.