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?
So, the below code is used to check whether Excel is installed or not. Type officeType = Type. GetTypeFromProgID("Excel. Application"); if (officeType == null) { // Excel is not installed. // Show message or alert that Excel is not installed. }
The executable file for Excel – Excel.exe – is located in the installation directory for the 64-bit version of Microsoft Office 365 at C:\Program Files\Microsoft Office\root\Office16.
Application(); // getting version of Server's Excel Application string versionName = xApp. Version; int length = versionName. IndexOf('. '); versionName = versionName.
Office. Interop. Excel' nuget package, and then add reference to 'Microsoft Excel 16.0 Object Library' (right click the project -> 'Add' -> 'Reference' -> search and add 'Microsoft Excel 16.0 Object Library' ). Click ''Interop.
Type officeType = Type.GetTypeFromProgID("Excel.Application"); if (officeType == null) { //no Excel installed } else { //Excel installed }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With