Hello,
I think that what I'm trying to do is impossible, but before I give up I
thought I'd try and pick a few more knowledgeable brains than my own.
I have any array of user defined type variables. I need to loop through the
array (doing certain calculations) on a particular member variable. I then
want to loop through the array again on a different member variable doing
very similar calculations. I only need to change a couple things in the
loop, otherwise the loop is identical from one member to the other. In a
nutshell, what I'm trying to do is use a variable, that will change its
contents accordingly, that I will use to rename the member within the array.
This seems harder to explain than perhaps showing an example:
ArryName(index).MemberName '----standard syntax for refering to a
varibale within an array of user defined type.
'I declare another variable to hold the changing member name that will
be used on repeating iterations through the same loop (using nested loops)
Dim ChangingMemberName as String
ChangingMemberName = ".MemberName1"
'1st iteration
ArryName(index).ChangingMemberName
'2nd iteration
ChangingMemberName = ".MemberName2"
ArryName(index).ChangingMemberName
This code does not work and only generates errors. It would appear that
trying to rename a member within an array with another variable is not
possible but the efficiencies to be gained are too great to give up on too
quickly. I've fiddled with variations on this (using brackets, quotations
marks, different variable types, with/without the dot etc.) with no luck.
Hope this seems clear. I realize that the above is not complete code but I
hope it gets the idea across.
Any advise appreciated.
Gord