2013-08-29

C#: If you stuck with an Excel interop

Error message:
System.Runtime.InteropServices.COMException (0x80028018): Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))

Solution:
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
WB = XL.Workbooks.Open(newfilepath, ...);

Set the CurrentCulture to en-US just before the Workbooks.Open(). This is required because the one and only VBA language supported by Excel is en-US.
And no, the Office MUI does NOT exists (altough it is often referenced on msdn...)

No comments :

Post a Comment