How to test if excel is installed?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top