title: Convert String to XlChartType in VBA
body: <p>In a worksheet I store a list of charts that I wish to create using VBA. For instance it would contain in a column:</p>
  
  <ul>
  <li>xl3DArea</li>
  <li>xlLine</li>
  </ul>
  
  <p>In my VBA routine I define a <code>XlChartType</code> variable as follows:</p>
  
  <pre><code>Dim chartType               As XlChartType
  </code></pre>
  
  <p>Later in the same routine I try to read in the chart type from the worksheet and assign it to the chartType variable using the following code (other code lines in with block removed):</p>
  
  <pre><code>With Worksheets(chartDetailsWorksheet)
  
      'Variable initialisations
      chartType = Cells(2, 2).value
  
  End With
  </code></pre>
  
  <p>But the code fails as the value read from the worksheet is treated as a string (not surprising). I've tried looking on line for an answer but...<br>
  I was thinking, like in other languages, you could do a type conversion to fix this issue quickly. But all I've found so far is a site talking of writing custom functions to convert the string value into <code>XlChartType</code> values. </p>
  
  <p>Is this the only way to handle this one?</p>