title: How can I create a proper Collection in VBA?
body: <p>I am trying to convert a large 3 dimensioned Array into a series of class modules. I have each next class stored as an array in the previous class. It goes like Brand -&gt; Products -&gt; Lots.</p>
  <p>I have successfully created this interaction and can access them by name like:</p>
  <pre class="lang-vb prettyprint-override"><code>Sub test()
      Dim MyBrand As Brand
      Set MyBrand = New Brand
      MyBrand.Name = &quot;Company1&quot;
      MyBrand.AddProduct &quot;Shoes&quot;
      MyBrand.Products(&quot;Shoes&quot;).AddLot &quot;240502&quot;
      MsgBox MyBrand.Products(&quot;Shoes&quot;).Lots(0) 'Correctly Displays &quot;240502&quot;
  End Sub
  </code></pre>
  <p>But then I wanted to create an object group that can save multiple <code>Brand</code> objects and access them like <code>Brands(&quot;Company1&quot;)</code>.</p>
  <p>If I used an array inside a class module, I'd end up with <code>Brands.Brand(&quot;Company1&quot;)</code>.
  If I used a <code>Collection</code>, I'd have to use indexes like <code>Brands(1)</code>.</p>
  <p>Is there a way to create a proper object group so that I can mimic the syntax of groups like Application.Workbooks and refer to members by Name?</p>