title: Dumping data into Excel from C# using set_Value throws an error
body: <p>I am trying to dump data into an Excel file. The following is the code we use. </p>
  
  <p>Note: dt is a DataTable passed from another function. </p>
  
  <pre><code>        ApplicationClass xlsApp = new ApplicationClass();
          WorkbookClass xlsWb = null;
          Worksheet xlsWs = null;
          Range ExcelCellText;
  
          try
          {
              xlsWb = (WorkbookClass)xlsApp.Workbooks.Open(@"E:\WorkingFolder\Code\EnVazhi2.xls", 0, false, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
              xlsWs = (Worksheet)xlsWb.Worksheets.get_Item(1);
  
              ExcelCellText = xlsWs.get_Range("A1", Missing.Value);
              ExcelCellText = ExcelCellText.get_Resize(dt.Rows.Count, dt.Columns.Count);
              string[,] myArray = new string[dt.Rows.Count, dt.Columns.Count];
  
              int iRow=0;
  
              foreach(DataRow dr in dt.Rows)
              {
                  for (int iCol = 0; iCol &lt; dt.Columns.Count; iCol++)
                  {
                      myArray[iRow, iCol] = dr[iCol].ToString();
                  }
                  iRow++;
              }
              System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); 
              ExcelCellText.set_Value(Missing.Value, myArray);
          }
          catch (Exception ex)
          {
              Console.Write(ex.Message);
          }
  </code></pre>
  
  <p>It throws the exception </p>
  
  <blockquote>
    <p>Exception from HRESULT: 0x800A03EC</p>
  </blockquote>
  
  <p>at the line </p>
  
  <pre><code>            ExcelCellText.set_Value(Missing.Value, myArray);
  </code></pre>
  
  <p>The Excel file is partly populated. The exception happens when it tries to copy this value from myArray into the Excel. </p>
  
  <blockquote>
    <p>Enawvg Xnhe/Bcrengvbaf/Ubzr
    Bssvpr/ZnkArjLbexYvsr  10-02-2009
    09:39 NZ       Gb PPEC/Bcrengvbaf/Ubzr
    Bssvpr/ZnkArjLbexYvsr@ZnkArjLbexYvsr
    pp</p>
    
    <p>Fhowrpg Sj: cyf vagvngr ershaq</p>
    
    <p>Uv,</p>
    
    <p>cyrnfr svaq gur pbeerpg cbyvpl ahzore</p>
    
    <p>268538840</p>
    
    <p>Enawvg Xnhe</p>
    
    <p>----- Sbejneqrq ol Enawvg Xnhe/Bcrengvbaf/Ubzr
    Bssvpr/ZnkArjLbexYvsr ba 02/10/2009
    09:38 NZ ----- PPEC/Bcrengvbaf/Ubzr
    Bssvpr/ZnkArjLbexYvsr 02/09/2009 05:37
    CZ       Gb Enawvg
    Xnhe/Bcrengvbaf/Ubzr
    Bssvpr/ZnkArjLbexYvsr@ZnkArjLbexYvsr
    pp</p>
    
    <p>Fhowrpg Er: cyf vagvngr ershaq</p>
    
    <p>Uv</p>
    
    <p>Gunax lbh sbe jevgvat gb Phfgbzre
    Freivprf ng Znk Arj Lbex Yvsr
    Vafhenapr. </p>
    
    <p>Jr npxabjyrqtr gur erprvcg bs lbhe
    inyhnoyr srrqonpx naq bhe Phfgbzre
    Freivpr Rkrphgvir jvyy trg va gbhpu
    jvgu lbh va gur arkg 48 ubhef.</p>
    
    <p>Cyrnfr abgr gung gur ersrerapr ahzore
    sbe lbhe srrqonpx ner</p>
    
    <p>268538295 2141982 268598840 vapbeerpg
    ab.</p>
    
    <p>Jr erdhrfg lbh gb dhbgr gur nobir
    ahzore va nyy shgher pbzzhavpngvba
    jvgu ZALY ercerfragngvirf.</p>
    
    <p>Lbh znl nyfb trg va gbhpu jvgu bhe
    Phfgbzre Uryc Yvar ahzore 1800 180
    5577 (gbyy serr vs pnyyvat sebz ZGAY
    be OFAY argjbex) be 0124-2542001</p>
    
    <p>Gunaxf naq Ertneqf Xnenz Fvatu
    Phfgbzre Freivprf Znk Arj Lbex Yvsr
    Vafhenapr Pb. Ygq. Bcrengvba Pragre,
    Cybg Ab. - 90 N Frpgbe - 18, Hqlbt
    Ivune Thetnba - 122002 Gry - 0124 -
    2542001 Gbyy Serr - 1800-180-5577 Snk
    ahzore -- 0124 - 4239683</p>
    
    <p>Enawvg Xnhe/Bcrengvbaf/Ubzr
    Bssvpr/ZnkArjLbexYvsr  09-02-2009
    03:07 CZ       Gb PPEC/Bcrengvbaf/Ubzr
    Bssvpr/ZnkArjLbexYvsr@ZnkArjLbexYvsr
    pp</p>
    
    <p>Fhowrpg cyf vagvngr ershaq</p>
    
    <p>Uv,</p>
    
    <p>cyf ybt n serfu pnfr</p>
    
    <p>ershaq purdhr abg erprvirq</p>
    
    <p>268538295 268598840</p>
    
    <p>Enawvg Xnhe</p>
  </blockquote>
  
  <p>Why does it throw an error? Is there a known issue with set_Value?</p>
  
  <p>I tried the following two options described here at <a href="http://www.made4dotnet.com/Default.aspx?tabid=141&amp;aid=15" rel="nofollow">Link 1</a></p>
  
  <p>Any suggestions or advice is greatly appreciated! Thanks!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This code works perfectly fine when I use Microsoft Office Excel 2007 SP 2. </p>
  
  <p>The version/SP of Microsoft Office Excel 2003 where it fails is this the Standard Release (with NO SP's installed). </p>