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