1

I have template .xlt excel files and try to show datas at .xltx or xlsx excel files.

ExcelApp = new Microsoft.Office.Interop.Excel.Application();

I try to open file with xlt extension as xltx

ExcelWorkBook = ExcelApp.Workbooks.Open(fileName,…)

When I open the file as named fileName, i get the the error

Exception from HRESULT 0x800A03EC

at this line

Range r = (Range) ExcelWorkBook.Columns["I", 0];
Liam
  • 27,717
  • 28
  • 128
  • 190
Anil Kocabiyik
  • 1,178
  • 6
  • 17
  • 47
  • Perhaps these answers may help? http://stackoverflow.com/questions/891394/excel-error-hresult-0x800a03ec-while-trying-to-get-range-with-cells-name – okrumnow Jun 26 '13 at 08:36

1 Answers1

0

This Problem could caused from CultureInfo. Or maybe there is some Old format or invalid type library.


An Idea to get around this error you can set CurrentCulture to en-US when executing code related to Excel and reset back to your originale by using these 2 functions.

//declare a variable to hold the CurrentCulture
System.Globalization.CultureInfo oldCI;

//get the old CurrenCulture and set the new, en-US
void SetNewCurrentCulture()
{
  oldCI = System.Threading.Thread.CurrentThread.CurrentCulture;
  System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
}

//reset Current Culture back to the originale
void ResetCurrentCulture()
{
  System.Threading.Thread.CurrentThread.CurrentCulture = oldCI;
}