COMException was unhandled:Old format or invalid type library
If you automate Microsoft Excel with Microsoft Visual Basic .NET, Microsoft Visual C# .NET, or Microsoft Visual C++, you may receive the following error when calling certain methods:
Error: 0x80028018 (-2147647512)
Description: Old Format or Invalid Type Library
Description: Old Format or Invalid Type Library
COMException was unhandled:Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
To work around this problem, you can use one of the following methods:
- Install the Multilingual User Interface Pack for yourversion of Office.
- Or, set the CultureInfo prior to calling the Excel method. For example:
代码System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");