Microsoft.Office.Interop.Excel doesn't work on 64 bit Microsoft.Office.Interop.Excel doesn't work on 64 bit asp.net asp.net

Microsoft.Office.Interop.Excel doesn't work on 64 bit


After digging the internet I found out that there is a bug in Microsoft Interop with COM objects (at least with my case which is MS Excel 2010).

The bug is that .NET checks that your thread (C# or VB code) localization is suitable to MS Excel localization you installed earlier, and if not it tells that the Microsoft.Office.Interop library is old or invalid.

Your thread localization is derived from your computer regional settings (from the control panel --> regional and language)

Then there are two options to solve this problem:

  1. To change your thread localization (by code)
  2. Install language pack for your Office

The first solution goes like this:

using System.Threading;     // For setting the Localization of the thread to fitusing System.Globalization; // the of the MS Excel localization, because of the MS bugThread.CurrentThread.CurrentCulture = new CultureInfo("en-US");excelFileName = System.IO.Path.Combine(excelPath, "Ziperty Buy Model for Web 11_11_2011.xlsm");

Hope it helps :)gr8 day