Private Sub VersionCheck_Click()
Dim excelVersion(12) As String
Dim iVer As Integer
excelVersion(7) = "95"
excelVersion(8) = "97"
excelVersion(9) = "2000"
excelVersion(10) = "2002"
excelVersion(11) = "2003"
excelVersion(12) = "2007"
iVer = 0
On Error GoTo weDone
'Attemp to create an Excel object
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
'Retrieve the version
iVer = objExcel.version
'Destroy the object
Set objExcel = Nothing
weDone:
If iVer < 7 Or iVer > 12 Then
MsgBox "You are using an unsupported version of Excel."
Else
MsgBox "You are using Excel " + excelVersion(iVer) + "."
End If
End Sub
Bookmarks