VBA Creating a variable name by concatenating string and variable?
<p>I am currently writing some VBA script with the final aim of comparing two dictionaries.</p>

<p>I have a large loop loading information into a dictionary from an xml file. To cut a long story short it ends with something like.</p>

<pre><code>    Dictionary.Add index, info
</code></pre>

<p>Now i would like to add the functionality to have 2 dictionaries (dictionary_1 and dictionary_2) and  choose which dictionary to write the information to by incorporating it in some kind of loop. This is what im thinking</p>

<pre><code>for i=1 to 2
    ("dictionary_" &amp; i).add key, info
next i
</code></pre>

<p>If this worked it would obviously just put the same information in the two dictionaries but that's not the point here, my question is:</p>

<p>How do i reference a variable this way concatenating some kind of string and variable?</p>

<p>Any thoughts or is this not possible/not a good idea for some reason that is beyond me?</p>