C# Excel Automation Library Exist?

Posted on 2006-05-17
Medium Priority
Last Modified: 2010-04-16
Is there anyway to verify if required version of Excel Automation Library exist in C#?
I would like to check for its existence before instantiate an instance of Excel.Application to prevent an error message that say Excel does not exist.
Question by:michellechan57
  • 2
  • 2
LVL 20

Accepted Solution

TheAvenger earned 1000 total points
ID: 16706701
What about try-catch around the code and catching the exception that is being thrown?

Expert Comment

ID: 16707087
You can try reading the Registry and see if you can find that ID in the registry.
Then you will know if it exists or not.

There are some configurations that may deny registry access - however you should give it a try.

Author Comment

ID: 16709571
I have tried to catch the exception but a dialog box pop up with message "... :Retrieving the COM class factory for component ... failed due to the following error: 80040154 ...".
I have also tried reading the registry but not all client PC has the necessary rights to access it.

I need a better (more graceful) method to disallow user to use the Excel Automation Library if it is not present.
LVL 20

Expert Comment

ID: 16709623
Did you debug the application? On which line does it fail?

Author Comment

ID: 16709847
OK, the error message was from the exception caught.
I missed the point. Answer accepted. Thanks.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question