Reading data from an MS project closed file into MS Word

hometech

New Member
Joined
Nov 21, 2012
Messages
4
Hello, please i need help reading data from a closed ms project file into my MS Word document, i want to be able to read data like projectStartDate, projectFinishDate, task, taskStart, taskFinish, PercentageComplete and so other information into my word document. a friend suggested using FileOpenEx property which i tried using but i dont seem to be able to walk round it please i need help in doing this

Code:
 Private Sub import()
    Dim part As String
    Dim mpp As MSProject.Application
    Dim eager As Date
    Dim myTask As Task
    Dim mystring As String
    Dim myRange As Range
    Set mpp = New MSProject.Application
    mpp = GetObject(part)
    mpp.FileOpenEx Name:="C:\Users\McBajo\Desktop\CPMS\tryout.mpp", ReadOnly:=True, openpool:=pjPoolReadOnly
    For Each myTask In mpp.Tasks
    If myTask.Notes <> "" Then
    mystring = myTask.UniqueID & ": " & myTask.Name & ": " & myTask.Notes & ": " & myTask.Start & ": " & myTask.Finish & ": " & myTask.PercentComplete & ""
    ActiveDocument.Tables(1).Cell(10, 2).Range.Text = mystring
    mpp.Quit
    Set mpp = Nothing
End Sub

please i need help with this, i really appreciate your suggestions
thanks
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,225,662
Messages
6,186,290
Members
453,348
Latest member
newbieBA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top