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

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");

     

posted @ 2010-01-15 10:08  禅酷  阅读(1352)  评论(0编辑  收藏  举报