The equivalence of EQUIVALENCE

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I've read elsewhere in this group that a construct like Fortran's
EQUIVALENCE doesn't exist in VBA, so let me please share the goal and
perhaps someone has a suggestion. I want to access certain elements of
an array by individual names. This is mostly for clarity of
programming, bug avoidance, etc. The array construct is necessary
because several operations have to be done on the array as a whole,
but writing and reading portions of it would be much easier to
document for those who follow if the individual elements had
meaningful variable names like tempLosAngeles instead of temp(6,9,7).
All bright ideas appreciated, and thanks.
 
Richard,

Maybe you could use a collection, which allows you to define a key for each
member.

hth,

Doug Glancy
 
Maybe you could use a collection, which allows you to define a key for each
member.

What a great title for a post!

The trouble with a Collection is that is impossible AFAIK to retrieve
the keys. I'm told this is possible with the scripting Dictionary
object, which also offers additional methods.

However, both a Collection and a Dictionary are essentially one
dimensional. So, when I need something more capable than a Collection,
I use a fabricated (disconnected) ADO Recordset, which has some very
useful properties and methods (Sort, Filter, GetRows, etc). Records
and Fields = 2D of course but another dimension may be added eith by
using key columns or even by fabricating a hierarchical recordset
(i.e. a recordset of recordsets) using the SHAPE provider and syntax.
There are some articles on MSDN e.g.

http://support.microsoft.com/default.aspx?scid=kb;en-us;196029

Jamie.

--
 

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

Back
Top