How to use redistributable PIA 2010 to create excel application on machine which doesn't have MS Office client installed

StackOverflow https://stackoverflow.com/questions/19493335

Question

From last couple of days I'm struggling with redistributable PIA 2010. Actually I have created one excel application locally, which uses 2007 PIA (I have also MS Office installed on my machine). This application was working fine, now I have installed the 2010 PIA and register it's Microsoft.Office.Interop.Excel dll then I have deleted then added this new dll in my earlier created excel application, but now application crashes on creation of excel object. i.e.

var app = new Application();

and below error is showing on browser.

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

Now, could anyone tell me what exactly wrong am I doing? Is this is the right approach to create excel application using only redistributable PIA 2010. If not, please help me out what is the correct approach to resolve this.

Was it helpful?

Solution

Redistributable PIAs are just a "complement" required by VS 2008 and older. The given MS Office version has to be installed on the target computer anyway. If you created an application relying on the Microsoft Excel Object of Office 2010 (version 14.0), it would only work on computers where Office 2010 is installed. If, on top of that, you built it by using VS 2008 or older, you would have also to install the corresponding PIA package.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top