title: C#: State of a Checkbox in MS Excel
body: <p>I am trying to acquire state of a checkbox existing in an XLS document via C#. Let me back up here. This is what I have:</p>
  
  <ul>
  <li>MS Office 2007 + Dev Tools and VC# 2010 Express</li>
  <li>Referenced MS Excel 12.0 Object Library</li>
  <li>An XLS document</li>
  </ul>
  
  <p>I successfully retrieve the Excel.Shape object. However, I am stuck when trying to determine whether it is checked or not. So far I have acquired its AutoShapeType, which says msoShapeMixed.</p>
  
  <p>Can someone point me to the right direction? Thanks!</p>
  
  <pre><code>  class Program {
      static void Main(string[] args) {
        Application excel = new Application();
        Workbook wb = excel.Workbooks.Open(
          "document.xls",
          Missing.Value, Missing.Value, Missing.Value, Missing.Value,
          Missing.Value, Missing.Value, Missing.Value, Missing.Value,
          Missing.Value, Missing.Value, Missing.Value, Missing.Value,
          Missing.Value, Missing.Value
        );
        Worksheet ws = wb.Worksheets[3];
        Microsoft.Office.Interop.Excel.Shape sh = ws.Shapes.Item("checkbox1");
        Console.WriteLine("[" + (sh.AutoShapeType.ToString()) + "]"); // msoShapeMixed
        Console.ReadLine();
      }
    }
  </code></pre>