0

Excel 2007 is installed in the system but not able to detect it by code.

Here is my code

Excel.Application _excelApp = null;
_excelApp = new Excel.Application();

_excelApp is returning null value.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
Deepak gupta
  • 1,938
  • 11
  • 11
  • 1
    There are lots of issues doing this from ASP.Net and its not recommended by Microsoft. A constructor can't return null so something else is occurring, No exception is thrown at all? – Alex K. Apr 22 '15 at 12:07
  • That is absolutely impossible... – leppie Apr 22 '15 at 12:07
  • Do you want to uninstall Excel 2007 programatically? – Microsoft DN Apr 22 '15 at 12:09
  • 2
    It turns out that in this case constructor can create null object. Read this article [link](https://msdn.microsoft.com/en-us/library/ms173186(v=vs.80).aspx). – sszarek Apr 22 '15 at 12:16
  • But this is happening, not able to find exact issue. @AlexK. – Deepak gupta Apr 22 '15 at 12:17
  • I don't want to uninstall the excel. This is working fine in one system, but not in other system.@MicrosoftDN – Deepak gupta Apr 22 '15 at 12:20
  • Exactly the same Excel on both systems? 2007 vs 2010, 64 bit vs 32 bit – sq33G Apr 22 '15 at 12:22
  • Is it really matter 64 bit or 32 bit?@sq33G – Deepak gupta Apr 22 '15 at 12:25
  • @Deepakgupta check this SO thread: [link](http://stackoverflow.com/questions/10477977/what-reference-do-i-need-to-use-microsoft-office-interop-excel-in-net) it says about installing office interop assemblies. Also check assembly references mentioned there. – sszarek Apr 22 '15 at 12:55
  • Which version of [Microsoft PIA](https://www.microsoft.com/en-us/download/details.aspx?id=18346) are you using with your project? – Black Frog Apr 23 '15 at 02:02

0 Answers0