How to check word, excel are installed in the machine

  • Thread starter Thread starter santel
  • Start date Start date
S

santel

Hi,

How to check whether the MSOffice files like word, excel, powerpoint
are installed in the machine or not? Anyone please help!
 
Hi,

How to check whether the MSOffice files like word, excel, powerpoint
are installed in the machine or not? Anyone please help!

There are a few ways. You could try the following:

try
{
Type officeType = Type.GetTypeFromProgID("Excel.Application");
if (officeType == null)
{
Console.WriteLine("Excel is missing");
}
else
{
Console.WriteLine("Excel is present");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

Or you could have a look in the registry for things like:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Excel\InstallRoot
and then check in that path for excel.exe.
 
Back
Top