How to check, programmatically, if MS Excel exists on a pc?

Christos Karapapas picture Christos Karapapas · Aug 19, 2011 · Viewed 20.9k times · Source

I have an application that needs MS Excel to run, otherwise it crashes. So I want to check and warn the user in case Excel is not installed on user's machine.

How do I do this?

Answer

Alec Sanger picture Alec Sanger · Aug 19, 2011
Type officeType = Type.GetTypeFromProgID("Excel.Application");
if (officeType == null)
{
     //no Excel installed
}
else
{
     //Excel installed
}