Accessing Manual Inputs using VBA

T

Tom K

In MSP Server I am using a custom date field. This date field is available
as input to a resource in 'My Tasks' in PWA. When a resource enters a date
in this field and I accept the change I can see this date in the 'Task Usage'
view in Project Professional in the resource line associated with the task.
The problem is that I cannot read it using VBA. This field seems to be a
separate field as if I manually put a date in this field it will overwrite
the Roll Down date when roll down is selected. If I delete the date, the
Roll Down date will propagate the field. It doesn’t appear to be related to
a Task Assignment or Resource Assignment.

Is there anyway to read this manually entered value using VBA? I want to do
a date comparison using this input.
 
J

Jack Dahlgren

The field is an assignment field.
I have not worked much with assignment fields in Project 2007, but I think
that they have changed the functionality and that you can't read this field.
It looks like an oversight...

-Jack
 
T

Tom K

I can read assignment fields in Project 2007 but the value in this field is
not readable as a Task Assignment or as a Resource Assignment. I can say
that playing with the Macros, I was able to write a routine to change the
value in the field. This was using the absolute address (row / col). In the
macro I recorded, it indicated that it was a Resource Field, which would go
along with the Assignment field.

The code used to read the Assignment values is below.

Dim Reso As Resource
Dim Task_As As Assignment
Dim Reso_As As Assignment
Dim Job As Task
Dim Task_TargetCompleteDate As String


For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
For Each Task_As In Job.Assignments
Task_ID = Job.ID
Task_As_Date = Task_As.Date1
Job_Date = Job.Date1

Task_AS_Date2 = Task_As.Date2
Job_Date2 = Job.Date2


Set Reso = ActiveProject.Resources(Task_As.ResourceID)
For Each Reso_As In Reso.Assignments
If Reso_As.TaskID = Job.ID Then
Reso_As_Date = Reso_As.Date1
Reso_Date = Reso.Date1

Reso_As_Date2 = Reso_As.Date2
Reso_Date2 = Reso.Date2
End If 'Task Id
Next Reso_As
Next Task_As
End If 'nothing
Next Job

The code from the macro is below:

SelectTaskField Row:=3, Column:="Date2", RowRelative:=False
SetResourceField Field:="Date2", Value:="4/15/08"

Is there a way to read a value in an absolute address?

Tom
 

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

Top