C# Excel Automation Library Exist?

Posted on 2006-05-17
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
    LVL 20

    Accepted Solution

    What about try-catch around the code and catching the exception that is being thrown?
    LVL 2

    Expert Comment

    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

    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

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

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    Title # Comments Views Activity
    prevent lose focus 6 48
    vb.Net Remove percent formatting textbox value 2 34
    WMI, model #, retrieving information 10 52
    report c# 9 56
    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now