How to test if excel is installed?

G

Guest

I'm trying to automate excel from visual c#. One thing I need to be able to
test is if excel is even installed on the target machine and what version of
excel is installed on the target machine. Is there a way to do this via c#
code?

Thanks.

Mansi
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi Mansi,

You can try to create an instance of Excel.Application object - if an
exception is thrown, Excel is most likely not installed.
As for specific version, you can use a version-dependent ProgID - say,
Excel.Application.9.0.

I think you can additionally check certain registry entries, but the check
above should be the primary one - if you are unable to access Excel through
COM interop, it's of no use for your app eve if it's been installed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top