VBScript 获得Excel的版本号

option Explicit
Dim objExcel

Set objExcel = CreateObject("Excel.Application")
'Set objWorkbook = objExcel.Workbooks.Open("E:\1.xls")
'objExcel.Visible = True
'objExcel.Cells(1, 1).Value = "Test value"
Dim strVersion
strVersion = GetExcelVersion()
MsgBox strVersion
objExcel.Quit()
objExcel = Nothing
Function GetExcelVersion()
	Dim ExcelVersion
    Select Case objExcel.Version
        Case "8.0"
            ExcelVersion = "97"
        Case "9.0"
            ExcelVersion = "2000"
        Case "10.0"
            ExcelVersion = "2002"
        Case "11.0"
            ExcelVersion = "2003"
        Case "12.0"
            ExcelVersion = "2007"
        Case "14.0"
            ExcelVersion = "2010"
         Case Else
            ExcelVersion = "未知版本"
        End Select
End Function

  请注明文章出处:http://www.cnblogs.com/zhfuliang

posted @ 2012-03-10 23:20  小小亮FLY  阅读(391)  评论(0编辑  收藏  举报