title: Getting Shape Type from Excel Shapes
body: <p>I have an Excel Sheet which has some combo boxes and checkboxes.</p>
  
  <p>I am trying to read their selected Values. My code works fine if there are combo boxes and crashes on Checkbox because there is no ListFillRange in them.</p>
  
  <p>How do I get the shape type of the shapes so that my function GetControlValue can return the values of all the controls types.</p>
  
  <pre><code>foreach (Excel.Shape s in ws.Shapes)
  {
      string value = GetControlValue(ws, s.Name);
  }
  
  
  private string GetControlValue(Excel.Worksheet ws, String shapeName)
  {
      var selValue = ws.Shapes.Item(shapeName).ControlFormat.Value;
  
      //the fill range
      var r = ws.Shapes.Item(shapeName).ControlFormat.ListFillRange;
      var oRng = ws.Range[r];
      var selectedValue = oRng.get_Item(selValue).Value;
      return selectedValue;
  </code></pre>
  
  <p>}</p>
  
  <p>There is one MsoShapeType enumeration as well but it always return msoFormControl</p>