Array Variable?

G

godfearer

I have found the following code:

For Each R In Proj.Resources
For Each A In R.Assignments
xlR.Range(headercolumns) = Array(A.ResourceName, A.TaskName, ProjectName,
A.Work / 60, A.Cost)

'Export Time Phased Data
Set Tsvs =
A.TimeScaleData(DateSerial(Year(Date), Month(Date), 1), _
DateSerial(Year(Date), Month(Date) +
12, 1 - 1), _
pjAssignmentTimescaledWork,
pjTimescaleMonths)

I don't understand what the Array item is in the 3rd line down. Is
that a Microsoft VBA function or method or a specific variable or
what. Please explain.

See the total code at http://office-watch.com/project/archtemplate.asp?3-20.

There may be online help or websites which describe this, but the word
"ARRAY" is so prevalent I haven't been able to find anything that addresses
its use shown here.
 
J

John

godfearer said:
I have found the following code:

For Each R In Proj.Resources
For Each A In R.Assignments
xlR.Range(headercolumns) = Array(A.ResourceName, A.TaskName, ProjectName,
A.Work / 60, A.Cost)

'Export Time Phased Data
Set Tsvs =
A.TimeScaleData(DateSerial(Year(Date), Month(Date), 1), _
DateSerial(Year(Date), Month(Date) +
12, 1 - 1), _
pjAssignmentTimescaledWork,
pjTimescaleMonths)

I don't understand what the Array item is in the 3rd line down. Is
that a Microsoft VBA function or method or a specific variable or
what. Please explain.

See the total code at http://office-watch.com/project/archtemplate.asp?3-20.

There may be online help or websites which describe this, but the word
"ARRAY" is so prevalent I haven't been able to find anything that addresses
its use shown here.

godfearer,
The "array" is a function in VBA. It is not unique to Project. I've
never used it in any of my macros but in the sample code you show it
looks like it is placing 5 elements from a array of Project data into a
header column in Excel.

You can find out more about the Array function and other VBA functions
by going to the VBA help file from the VB editor window. The Array
function is listed under, Microsoft Visual Basic Documentation/Visual
Basic Language Reference/Functions/A-C.

Hope this helps.
John
Project MVP
 
J

Jan De Messemaeker

Thanks John, I had been looking for it but for some reason the Object
Browser (my VBA bible!) doesn't know the function.
 
J

John

Jan De Messemaeker said:
Thanks John, I had been looking for it but for some reason the Object
Browser (my VBA bible!) doesn't know the function.

Jan,
For some reason there are several general VBA functions that do not
appear in the object browser. For example, manipulating directories with
old DOS commands is only discussed under the VBA help menu.

Anyway, glad to help.

John
 
J

Jack Dahlgren

That usually means that they are just maintained for compatibility. In that
case it is usually a good idea to move to what replaced it.
 

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

Similar Threads


Top