Array Values and Methods

G

Guest

All,
I received help in here yesterday regarding a non Excel question, hopefully
you can help again. There appear to be aton more users in here than in the
MS Project forum. My question is this....
I am trying to populate a Two Dimesnional Array, with the second Value in
the Array being a value determined by a method. The method is described
below, it is an MS Project method.
*****************************************
CustomFieldGetName Method


Returns the friendly name for a custom field.
Syntax
expression.CustomFieldGetName(FieldID)
expression Optional. An expression that returns an Application object.
FieldID Required Long. The custom field. Can be one of the following
PjCustomField constants:
pjCustomTaskText1, etc.
************************************************

So right now the second part of my Array looks like this...

Data2(1, 2) = CustomFieldGetName(pjCustomTaskNumber1)
Data2(2, 2) = CustomFieldGetName(pjCustomTaskNumber2)
Data2(3, 2) = CustomFieldGetName(pjCustomTaskNumber3)
etc.

This method works fine, but I have at least 100 of these fields. I'm just
trying to reduce the number of lines of code. So what i would like to do is
something like this

For i =1 To 100
Data2(i,2) = "CustomFieldGetName(pjCustomTaskNumber" & i & ")"
Next

Obviously though, once I do this it fills the Array with the text
"pjCustomTaskNumber1" rather than the returned value.

Any help would be greatly appreciated.

DMS
 
B

Bob Phillips

I do not know MS Project or where the values pjCustomTaskNumber1, etc. get
loaded, but perhaps you could use another array

Dim aryTasks(1 To 100)

'code to load the values

For i =1 To 100
Data2(i,2) = CustomFieldGetName(aryTasks(i))
Next


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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