J
Jimmy
Assume I open two files in MSProject2003. a.mpp and b.mpp. b.mpp was
created from a.mpp and entire groups of tasks were added/deleted, moved,
%Complete ....
Now, we need to recover some of the information from the old file and figure
the best way to do it is to write the information back to b.mpp from a.mpp
using VBA.
What I want to do is update inforamtion in a.mpp be examinging the data in
b.mpp
Here is what I have so far in a.mpp, but it will not compile:
[Both of these projects are open in Project]
Public Sub CorrectIt()
Dim OtherFile As Project
'It Dies on the next line of code:
OtherFile.FullName = FileOpen("E:\b.mpp")
Dim aTask As Task 'Task Collection in a.mpp
Dim bTask As Task 'Task Collection in b.mpp
On Error Resume Next
For Each aTask In ActiveProject.Tasks 'Assume a.mpp
For Each bTask In OtherFile.Tasks 'Assume b.mpp
If (aTask.UniqueID = b.UniqueID) Then
b.Text15 = a.Text15
'There are others .... %Complete, Actual Start, etc. But I think I can work
that.
End If
Next bTask
Next aTask
End Sub
I am thinking I need to use the Projects object, but can't seem to get that
to work.
Thanks in advance.
created from a.mpp and entire groups of tasks were added/deleted, moved,
%Complete ....
Now, we need to recover some of the information from the old file and figure
the best way to do it is to write the information back to b.mpp from a.mpp
using VBA.
What I want to do is update inforamtion in a.mpp be examinging the data in
b.mpp
Here is what I have so far in a.mpp, but it will not compile:
[Both of these projects are open in Project]
Public Sub CorrectIt()
Dim OtherFile As Project
'It Dies on the next line of code:
OtherFile.FullName = FileOpen("E:\b.mpp")
Dim aTask As Task 'Task Collection in a.mpp
Dim bTask As Task 'Task Collection in b.mpp
On Error Resume Next
For Each aTask In ActiveProject.Tasks 'Assume a.mpp
For Each bTask In OtherFile.Tasks 'Assume b.mpp
If (aTask.UniqueID = b.UniqueID) Then
b.Text15 = a.Text15
'There are others .... %Complete, Actual Start, etc. But I think I can work
that.
End If
Next bTask
Next aTask
End Sub
I am thinking I need to use the Projects object, but can't seem to get that
to work.
Thanks in advance.