• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

C# Excel Automation Library Exist?

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.
0
michellechan57
Asked:
michellechan57
  • 2
  • 2
1 Solution
 
TheAvengerCommented:
What about try-catch around the code and catching the exception that is being thrown?
0
 
mitchellm44Commented:
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.
0
 
michellechan57Author Commented:
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.
0
 
TheAvengerCommented:
Did you debug the application? On which line does it fail?
0
 
michellechan57Author Commented:
OK, the error message was from the exception caught.
I missed the point. Answer accepted. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now