title: Excel worksheet get item
body: <p>I have a problem with Excel worksheet. I am trying to create an Excel file with c#.</p>
  
  <p>This code works and runs correctly on my computer but in other computers get an error at last line:</p>
  
  <pre><code>Excel.Application xlApp;
  Excel.Workbook xlWorkBook;
  Excel.Worksheet xlWorkSheetInvoice;
  Excel.Worksheet xlWorkSheetInvoiceLine;
  
  object misValue = System.Reflection.Missing.Value;
  
  xlApp = new Microsoft.Office.Interop.Excel.Application();
  xlWorkBook = xlApp.Workbooks.Add(misValue);
  
  xlWorkSheetInvoice = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
  
  xlWorkSheetInvoiceLine = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(2);
  </code></pre>
  
  <blockquote>
    <p>System.Runtime.InteropServices.COMException (0x8002000B): Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
       at Microsoft.Office.Interop.Excel.Sheets.get_Item(Object Index)</p>
  </blockquote>