Custom field formula reference to other task

C

Conrad Santiago

In a formula for a custom field, is there a way to reference another task?
For example, for a custom text field on a task, I want the field to show what
is in a cell on it's summary task.
Is this possible? If so, how?

Thanks in advance for your response.

Conrad Santiago
 
E

Earl Lewis

Conrad,

You should be able to do this with a very simple VBA routine.

Basically, the code would have to identify a tasks outline parent at run time, find the field you want to use/reference and then put something in the current task based on what it found in the parent.

Yeah, this is very doable. Hold on - I'll whip up a little sample. waiting......

Ok - I'm back.

Here's a sample of what you could do:

Sub TestParent()
Dim myTask As Task
Set myTask = Application.ActiveProject.Tasks(4)
If myTask.OutlineParent.Summary = True Then
myTask.Cost1 = myTask.OutlineParent.Cost1
End If
End Sub

Basically, this says: find task 4 and then check to see if task 4's outline parent is a summary task and if it is copy the value from Cost1 in the summary task to the Cost1 field in the current task. Voila!

Copy this code into the VBA environment on project, open or create a small plan making sure task 4 is indented below a summary task and the summary task has a value in Cost1. Then run the macro. You should see it copy the amount to the 4th task.

Obviously, you'd need to work out the details of which tasks you select, how you select them and which specific fields you read and write.

If you want any help with specifics post your desire/requirements and we'll try to give you a hand.

FYI, the microsoft.public.project.developer NG might be a better place to post this kind of question.

Earl
In a formula for a custom field, is there a way to reference another task?
For example, for a custom text field on a task, I want the field to show what
is in a cell on it's summary task.
Is this possible? If so, how?

Thanks in advance for your response.

Conrad Santiago
 
C

Conrad Santiago

Earl,
I see where you are going with this. This is a macro that would need to be
run manually. I was looking for something that would populate a field
automatically...in this case, it was through the formula defining a field.
In any case, thanks for whipping that together. I could use the idea in
other ways.

--Conrad Santiago
 
E

Earl Lewis

Conrad,

You could use one of the standard MSProject events, like Project_Open, Project_BeforeClose, Project_BeforeSave, etc... to trigger this routine. That could be a pretty good approximation of automatically populating the field. Of course, you could also go to the extent of popping up a warning message and asking the user if they want to run the update now or later.

Earl
Earl,
I see where you are going with this. This is a macro that would need to be
run manually. I was looking for something that would populate a field
automatically...in this case, it was through the formula defining a field.
In any case, thanks for whipping that together. I could use the idea in
other ways.

--Conrad Santiago
 

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