0

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.

Lavanya
  • 3,903
  • 6
  • 31
  • 57
Geeky Ninja
  • 6,002
  • 8
  • 41
  • 54

1 Answers1

2

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.

varocarbas
  • 12,354
  • 4
  • 26
  • 37
  • Hi Varocarbas, So you mean to say that this isn't possible to deploy an excel application on server where MS Office is not installed. But, I have read somewhere that this can be achieve by using 2010 PIA. Isn't the case? – Geeky Ninja Oct 21 '13 at 11:57
  • @Ryan It is possible to run Excel-based applications without the given MS Office version installed, but not via interop/COM Excel Object. PIAs are, as said, just a small compensation for a VS limitation, they don't have any capability to account for all what an installed MS Office program can. If you want to run Excel-based programs without the given MS Office version installed, you should post a new question by explaining exactly your conditions and what you want (there are external libraries and also .NET-based approaches). – varocarbas Oct 21 '13 at 12:02
  • could you please suggest some material/links on PIA, so that it'll be easier for me to understand PIA. – Geeky Ninja Oct 21 '13 at 12:31
  • @Ryan you are misunderstanding the exact relevancy of the PIAs; they are just a small (a tiny actually) package compensating limitations of old Visual Studio versions. What you actually use to connect Excel is Interop/COM objects, which require the given version of MS Office to be installed. You don't need to rely on Interop/Excel COM objects and thus might avoid this requirement of having the given version installed. I personally use Interop as much as possible as far as it is reliable and you have lots of codes helping you to implement anything. But all this on desktop; for servers... – varocarbas Oct 21 '13 at 12:34
  • @Ryan it is actually not recommended to rely on Interop (because this is an approach created for desktop-based programs), as far as there are other libraries more adapted to a web-based environment. Perhaps you should do some research/work by your own before asking (remember: asking for a recommendation regarding the most adequate library is one of the reasons to set a question as Off-topic). In any case, I don't think that all this belongs to your original question. I have answered what you asked: what are PIAs exactly for and what you can/cannot get. – varocarbas Oct 21 '13 at 12:38
  • @Ryan I have observed that you have unmarked this answer as the right one. Is there anything wrong with it? Shall I delete it? – varocarbas Apr 08 '14 at 13:37
  • @Ryan As far as I am getting a bit allergic to some pointless behaviours I am seeing in Stack Overflow (actually, this is the only reason why I am not answering questions anymore: not interested in dealing with certain people), I hope that you would understand that in case of not getting any (sensible) reply from you I would contact the moderators. Logically, you are free to do whatever you want; but I don't think that SO should allow unmotivated, targetted-to-specific persons (myself, in this case) behaviours. I apologise if I have misunderstood your intention. Will be back in some days. – varocarbas Apr 08 '14 at 14:21
  • @Ryan You are free to mark/unmark the answer; even you don't need to give reasons. But suddenly unmarking it after so long sounded a bit weird to me. You should use the voting system as intended (= to help future readers to know about the quality of the question/answer), not to appraise/punish a specific user because of something outside the q/a. If you consider that there is something in my answer which should be improved, please let me know. – varocarbas Apr 09 '14 at 07:21