title: Creating a Container Property in a VBA Class which returns Indexed Items (Excel VBA 2003)
body: <p>I started learning VBA for my job at the end of last summer, and I can proudly say this is the first time I haven't be able to find the answer on Google. I started teaching myself about Classes this week, and I have come across a situation where I would like to be able to identify an "indexed property" for my class. </p>
  
  <p>Since that probably isn't the clearest explanation, here is a hypothetical example:</p>
  
  <p>The class which I have created for my super awesome sandwich shop (clsSASS) contains properties for Calories, Weight in Grams, Price, and Ingredients. The first three are variables with very straight forward let and get statements. I.E.:</p>
  
  <pre><code>Public pCal As Integer 
  
  Public Property Get Calories() As Integer
      Calories= pCal
  End Property
  
  Public Property Let Calories(Value As Integer)
      pCal = Value
  End Property
  </code></pre>
  
  <p>Ingredients however is designed to contain, in order of entry, the list of ingredients. My initial instinct was to do something like this:</p>
  
  <pre><code>Public pIngd  As Collection
  
  Public Property Get Ingredients(Value As Integer) As Collection
      Ingredients = pIngd(Value)
  End Property
  
  Public Property Set Ingredients(Object As Collection)
      Set pIngd = Object
  End Property
  </code></pre>
  
  <p>So if Bacon were the first ingredient in the list (and let's be honest it always would be), something like clsNewSandwich.Ingredients(1) would return the string 'Bacon'. </p>
  
  <p>The problem arose when I added a container property to a class, and then couldn't figure out how to identify the individual items in the container. So this may just be a simple syntax issue that has nothing to do with classes whatsoever. </p>
  
  <p>Many Thanks!</p>
  
  <p>*edited for clarity/continuity</p>