如何以编程方式检测Excel版本

时间:2014-04-21 21:40:50

标签: excel registry version

在我的安装程序中,我检查了注册表项(HKEY_CLASSES_ROOT \ Excel.Application \ CurVer)以获取Excel版本。 它从第1天起就开始工作了。 但是,最近我们发现在一台客户端的PC上没有这样的密钥而我的安装程序失败了。 所以我想知道是否有任何其他注册表项来获取Excel的版本? 或者客户的Excel有问题吗?

谢谢

编辑

客户端有办公室2010(32位),Windows 7(64位)。

2 个答案:

答案 0 :(得分:0)

Sub dural()
    MsgBox Application.Version
End Sub

在我的机器上,Excel 2007的产量为12.0

答案 1 :(得分:0)

使用Application.Version

Sub Excel_Version()

Select Case (Val(Application.Version))

Case 8
        MsgBox "You use Excel 97"
Case 9
        MsgBox "You use Excel 2000"
Case 10
        MsgBox "You use Excel 2002"
Case 11
        MsgBox "You use Excel 2003"
Case 12
        MsgBox "You use Excel 2007"
Case 14
        MsgBox "You use Excel 2010"
Case 15
        MsgBox "You use Excel 2013"
End Select

    MsgBox "Welcome to Microsoft Excel version " & _
    Application.Version & " running on " & _
    Application.OperatingSystem & "!"

End Sub
相关问题