Can a string be used as an index?

In other languages, you can use strings as keys -

PHP:

$array['string'] = 50; 
$array['anotherstring'] = 150;

      

Is this possible in VBA?

+1


source to share


3 answers


In VBA, you can create a Collection object. Items in a collection can be accessed using an index (long integer) or string key.



+5


source


Did you read a Dictionary object?



http://msdn.microsoft.com/en-us/library/aa164502(office.10).aspx

+3


source


I haven't used VBA in a long time, but these are not arrays, they havehes (in perl) and associative arrays (in PHP). If you're looking for an answer, you can get better results by looking for one of these terms and VBA, not just "array".

As far as I know, VBA doesn't have its own hash table type, but as I said, it's been a while since I used it, so I might be wrong.

0


source







All Articles