assign properties to array elements

What is the best approach for creating my own properties to items in an array?

For example, I will have an array of places.  The Array will be populated by a list created by the user on an excel worksheet.  I would like each place to have properties, such as name, etc., etc.  Some properties will be assigned through the list the user created, others will be assigned from external data (Web Query).  

I'm thinking (after being setup properly) assigning a value to the property would look something like this: place(i).name = "Hell".

Any insight is appreciated, thanks.
growedupAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Chris BottomleyConnect With a Mentor Commented:
You could declare a type and then assign the type of the variable to that i.e.

type fred
    place as string
    name as string
end type

dim arr(1 to 3) as fred

arr(1).name = "norman"
arr(1).place = "hell"

Chris
0
 
x-menIT super heroCommented:
crate an array within the array
properteis[0] = "hell" ' Name
properteis[1] = .. ' other property
...

Places(i,properties(x))
0
 
x-menIT super heroCommented:
Places(i,properties(x)) is not in the ccoorect syntax
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Michael FowlerConnect With a Mentor Solutions ConsultantCommented:
you could always use a dictionary instead of an array.
Have a look at
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/A_3391-Using-the-Dictionary-Class-in-VBA.html
for more info on this class
0
 
growedupAuthor Commented:
For this project, declaring a type is the best solution.  Using a dictionary is a great solution as well, but is too complex for this project.  I will definately be considering it for future projects though.
0
 
growedupAuthor Commented:
Thanks for all the fast inputs everyone!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.