Project - Updating Assignments fail with SP2

Asked By SteDal on 13-Oct-09 11:07 AM
This relates to Ms Project 2007, with no Project Server.

We have VBA that import Task Assignment data from a file. This has worked
well for years. In SP2, it goes wrong. The failing line would look like this:

ActiveProject.Tasks.UniqueID(TaskUid).Assignments.UniqueID(AssignmentUid).Cost1 = x ' Where x is a Long

Pre SP2 this used to update the Cost1 custom field with the value x.
In SP2 the Cost1 field remains unchanged, and it appears SP" has updated one
of the Enterprice Fields instead. I believe these are hidden somewhere in the
internals of the mpp file. We can see the value of x (if set to a easily
recognizable number) in the XML file if the project is exported to XML. Then
it looks like this:


if x = 400000.

We believe this is a SP2 bug.
Does anybody out there have info if MS knows about this, has fixed it, or a
work around?

SteDal.


Jack Dahlgren MVP replied to SteDal on 13-Oct-09 12:03 PM
Might be a datatype issue. How about trying:

ActiveProject.Tasks.UniqueID(TaskUid).Assignments.UniqueID(AssignmentUid).Cost1
= CCur(x)

Are you sure that the other parameters are valid? What is the value of x
when it fails?

-Jack Dahlgren
SteDal replied to Jack Dahlgren MVP on 13-Oct-09 05:26 PM
Thanks Jack. I have now done lots of testing using different data types and
methods. It still fails.

Also reading the Assignment data fails, after the first attempt on assigning
Assignment data as I described. Same is using the global assign method as
described in Rod Gills book at the bottom of page 159.

When I say "fail" there is no error message generated, and it is not a
special value that generated the failure. It is simply assigning data to one
Custom field that seam to initiate the failure. Assignment goes "fine" in
that it can be read with the opposite command. But  when you look in View >
Resource Usage and look at Cost1, it is disconnected to VBA after you VBA has
assigned an Assignment Custom field.

Reproducing this can be done as follows:

1) Open a new project (mpp)
2) Make one Task, and assign one resource
3) In View > Resource Usage insert Unique ID and Cost1, and enter 1234 in
Cost1
4) In VBA run debug.print
ActiveProject.Tasks.UniqueID(1).Assignments.UniqueID(AssignmentUid).Cost1 '
where AssignmentUid is taken from Resource Usage View
6) This displays 1234 as it should
7) In VBA run
ActiveProject.Tasks.UniqueID(1).Assignments.UniqueID(AssignmentUid).Cost1 =
CCur(5678)
8) Re-run 4 above, and it will display 5678 (as expected)
9) Look at the View > Resource Usage Cost1 is still 1234, not 5678 as expected
10) Enter 444 in View > Resource Usage Cost1 manually
11) Re-run 4 above. It will display 5678 as assigned in 7 above, and not 444
as it should.

So after stop 7 above,  the new project is in a state (also after save +
open) where VBA and View > Resource Usage is disconnected.

Please help,

SteDal.