Object model - assignment fields where resource is unassigned


Alan GW


(MS Project Standard 2003)

I want to programmatically set the Text1 field for all assignments,
including those that are unassigned. (I might have thought there's no such
thing as an unassigned assignment, but if you add column Text1 to the
resource usage view you will find that you can enter values for all
assignments, including those where the resource is unassigned, and all the
values are retained.)

As far as I can see, the only way in the object model to get at an
assignment object is via task or via resource. But mytask.assignments only
includes items where resource has been assigned, and (hardly surprisingly)
there's no resource object for the null resource.

So, the question:
Is it posible to access this data via the object model, and if so how? If
not, then is there some other way?

Many thanks in advance for replies

ps to clarify further, the following code successfully sets the text1 field
for all assignments which do have resource, but I want to do the same where
the resource usage view shows resource as Unassigned.

Dim myTask as Task
Dim myAssignment as Assignment

For Each myTask in ActiveProject.Tasks
If Not myTask Is Nothing Then
For Each myAssignment in myTask.Assignments
myAssignment.Text1 = "some specific value"
Next myAssignment
End If
Next myTAsk

(Obviously for real I'm not setting these all to the same value.......)



Jack Dahlgren

It has been a while since I've worked with Proj 2003, but I think it might be
possible that the Text1 for the task is going into the task.text1 field,
rather than the assignment text1. I can't confirm this because I don't have
2003 available. Switch to the Task Usage view and see what is going on. Or
try recording a macro and see what sort of code is generated.

The behavior was changed with Project 2007 and I think that Microsoft is
still a bit confused about how this "should" work.

-Jack Dahlgren



Alan GW

Thanks for the input Jack; I can confirm that entering a value in text1 in
the resource usage view in a row where resource is "unassigned" does not
overwrite the corresponding task.text1, so I'm still holding on to my working
hypothesis that there "really is" an "unassigned assignment", even though
there may be no way of getting at it via the exposed object model.

Best regards,

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question