title: Excel VBA refer to chart seriescollection by string name
body: <p>I have a need to refer to a seriescollection by name. The MSDN object model page for seriescollection states either an index or a name can be used. However when I try to use a string variable I get error 1004 'Invalid parameter':</p>
  
  <pre><code>Dim sSeriesName As String
  dim aRootCats() as string
  Dim cSeriesCol As SeriesCollection
  
  For x = 0 To UBound(aRootCats)
      sSeriesName = aRootCats(x)
      Set cSeriesCol = cChart.ChartGroups(1).SeriesCollection(sSeriesName)
  Next x
  </code></pre>
  
  <p>I've tried the following too:</p>
  
  <pre><code>    sSeriesName = CStr(aRootCats(x)) ' just in case, because I filled this array with variant data type earlier
      Set cSeriesCol = cChart.ChartGroups(1).SeriesCollection(sSeriesName)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    Set cSeriesCol = cChart.ChartGroups(1).SeriesCollection(aRootCats(x))
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    Set cSeriesCol = cChart.ChartGroups(1).SeriesCollection("Product Support")
  </code></pre>
  
  <p>UPDATE: I'm also experiencing the same error when looping on the seriescollection:</p>
  
  <pre><code>For c = 1 To cChart.ChartGroups(1).SeriesCollection.Count
      Set cSeriesCol = cChart.ChartGroups(1).SeriesCollection(c)
  Next c
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Many thanks.</p>