J
Joy
one user told us that when he uses our macros to export ms project to server
(we are not using ms server). after the export, the predecessor fields in the
ms project file are gone, empty.
I worked it with ms project 2002 version, I do not have the problem.
but when I use 2007, the problem exists.
I find the problem lies in map. we have a map named export map. at the end
of export, server sends back data to a csv file. I checked the csv file
before map, the predecessros data are there and all right.
the codes are:
Open GetTempDir & "\Export.csv" For Output As #1
Print #1, Trim(taskCSV)
Close #1
' Open the file in MS Project and merge changes using the map (merge on
unique_id)
On Error GoTo 0
FileOpen Name:=GetTempDir & "\Export.csv", FormatID:="MSProject.CSV",
Merge:=2, map:="Export Map"
I then fix the problem by add codes. the new is to copy the predecessor
fields before map to anther field. after map, it copies it back.
Open GetTempDir & "\Export.csv" For Output As #1
Print #1, Trim(taskCSV)
Close #1
For i = 1 To ActiveProject.Tasks.Count
ActiveProject.Tasks(i).Text7 = ActiveProject.Tasks(i).UniqueIDPredecessors
Next
' Open the file in MS Project and merge changes using the map (merge on
unique_id)
On Error GoTo 0
FileOpen Name:=GetTempDir & "\Export.csv", FormatID:="MSProject.CSV",
Merge:=2, map:="Export Map"
For i = 1 To ActiveProject.Tasks.Count
ActiveProject.Tasks(i).UniqueIDPredecessors = ActiveProject.Tasks(i).Text7
Next
then it seems ok. but I feel it is not efficient since it copies field value
task by task. If a project has many tasks, it will be very slow.
I am wondering whether this is my code issue, or 2007 issue...
is there any way to check what kind of ms project version user is using
before we do export?? If I check that users are using 2007, I add the codes.
If not, I choose not to add the codes.
(we are not using ms server). after the export, the predecessor fields in the
ms project file are gone, empty.
I worked it with ms project 2002 version, I do not have the problem.
but when I use 2007, the problem exists.
I find the problem lies in map. we have a map named export map. at the end
of export, server sends back data to a csv file. I checked the csv file
before map, the predecessros data are there and all right.
the codes are:
Open GetTempDir & "\Export.csv" For Output As #1
Print #1, Trim(taskCSV)
Close #1
' Open the file in MS Project and merge changes using the map (merge on
unique_id)
On Error GoTo 0
FileOpen Name:=GetTempDir & "\Export.csv", FormatID:="MSProject.CSV",
Merge:=2, map:="Export Map"
I then fix the problem by add codes. the new is to copy the predecessor
fields before map to anther field. after map, it copies it back.
Open GetTempDir & "\Export.csv" For Output As #1
Print #1, Trim(taskCSV)
Close #1
For i = 1 To ActiveProject.Tasks.Count
ActiveProject.Tasks(i).Text7 = ActiveProject.Tasks(i).UniqueIDPredecessors
Next
' Open the file in MS Project and merge changes using the map (merge on
unique_id)
On Error GoTo 0
FileOpen Name:=GetTempDir & "\Export.csv", FormatID:="MSProject.CSV",
Merge:=2, map:="Export Map"
For i = 1 To ActiveProject.Tasks.Count
ActiveProject.Tasks(i).UniqueIDPredecessors = ActiveProject.Tasks(i).Text7
Next
then it seems ok. but I feel it is not efficient since it copies field value
task by task. If a project has many tasks, it will be very slow.
I am wondering whether this is my code issue, or 2007 issue...
is there any way to check what kind of ms project version user is using
before we do export?? If I check that users are using 2007, I add the codes.
If not, I choose not to add the codes.