Need some testers to display there findings from the following script that checks for excel version being used

johnnyL

Well-known Member
Joined
Nov 7, 2011
Messages
4,546
Office Version
  1. 2007
Platform
  1. Windows
VBA Code:
Sub ExcelVersionChecker()
'
    Dim ExcelVersion As Integer
'
    ExcelVersion = Application.Version
'
    Select Case ExcelVersion
        Case 8:
            ThisVersionfExcel = "Excel 97"
        Case 9:
            ThisVersionfExcel = "Excel 2000"
        Case 10:
            ThisVersionfExcel = "Excel 2002"
        Case 11:
            ThisVersionfExcel = "Excel 2003"
        Case 12:
            ThisVersionfExcel = "Excel 2007"
        Case 14:
            ThisVersionfExcel = "Excel 2010"
        Case 15:
            ThisVersionfExcel = "Excel 2013"
        Case 16:
'           Test for Excel 2016, 2019 and 365 in Win and Mac Excel
            Dim Case16Result As String
'
            On Error Resume Next
'
'           Test for the XMATCH function available in Excel 365
            Case16Result = Application.Evaluate("=XMATCH(5,{5,4,3,2,1})")
'
            If Err = 0 Then
                ThisVersionfExcel = "Excel 365"
            Else
                Err.Clear
'
'               Test for the CONCAT function available in Excel 2019
                Case16Result = Application.Evaluate("=CONCAT(""A"",""B"")")
'
                If Err = 0 Then
                    ThisVersionfExcel = "Excel 2019"
                Else
                    Err.Clear
                    ThisVersionfExcel = "Excel 2016"
                End If
            End If
        Case Else:
            ThisVersionfExcel = "Excel Unknown Version of " & ExcelVersion
    End Select
'
    MsgBox "You are running " & ThisVersionfExcel & " on " & Application.OperatingSystem & "."
'
End Sub

Just want to see how accurate it is.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
✅
1627534379775.png
1627534480158.png
 
Upvote 0
Mine was the same as kennypete and correct for my machine.
Note: I had to add a dim statement to your code
Dim ThisVersionfExcel As String
 

Attachments

  • 1627534806656.png
    1627534806656.png
    7.5 KB · Views: 6
Upvote 0
Here is Version2 BTW:

VBA Code:
Sub ExcelVersionCheckerV2()
'
    Dim ExcelVersion        As Integer
    Dim ThisVersionfExcel   As String
'
    ExcelVersion = Application.Version
'
    Select Case ExcelVersion
        Case 8:
            ThisVersionfExcel = "Excel 97"
        Case 9:
            ThisVersionfExcel = "Excel 2000"
        Case 10:
            ThisVersionfExcel = "Excel 2002"
        Case 11:
            ThisVersionfExcel = "Excel 2003"
        Case 12:
            ThisVersionfExcel = "Excel 2007"
        Case 14:
            ThisVersionfExcel = "Excel 2010"
        Case 15:
            ThisVersionfExcel = "Excel 2013"
        Case 16:
'           Test for Excel 2016, 2019 and 365 in Win and Mac Excel
            Dim Case16Result As String
'
            On Error Resume Next
'
'           Test for the XMATCH function available in Excel 365
            Case16Result = Application.Evaluate("=XMATCH(5,{5,4,3,2,1})")
'
            If Err = 0 Then
                ThisVersionfExcel = "Excel 365"
            Else
                Err.Clear
'
'               Test for the CONCAT function available in Excel 2019
                Case16Result = Application.Evaluate("=CONCAT(""A"",""B"")")
'
                If Err = 0 Then
                    ThisVersionfExcel = "Excel 2019"
                Else
                    Err.Clear
                    ThisVersionfExcel = "Excel 2016"
                End If
            End If
        Case Else:
            ThisVersionfExcel = "Excel Unknown Version of " & ExcelVersion
    End Select
'
    MsgBox "You are running " & ThisVersionfExcel & " build #" & Application.Build & " of " & Application.OperatingSystem & "."
'
End Sub
 
Upvote 0
OK, so EXCEL 365 apparently checks good, any other testers?
 
Upvote 0
A spell correction:

VBA Code:
Sub ExcelVersionCheckerV2.5()
'
    Dim ExcelVersion        As Integer
    Dim ThisVersionOfExcel   As String
'
    ExcelVersion = Application.Version
'
    Select Case ExcelVersion
        Case 8:
            ThisVersionOfExcel = "Excel 97"
        Case 9:
            ThisVersionOfExcel = "Excel 2000"
        Case 10:
            ThisVersionOfExcel = "Excel 2002"
        Case 11:
            ThisVersionOfExcel = "Excel 2003"
        Case 12:
            ThisVersionOfExcel = "Excel 2007"
        Case 14:
            ThisVersionOfExcel = "Excel 2010"
        Case 15:
            ThisVersionOfExcel = "Excel 2013"
        Case 16:
'           Test for Excel 2016, 2019 and 365 in Win and Mac Excel
            Dim Case16Result As String
'
            On Error Resume Next
'
'           Test for the XMATCH function available in Excel 365
            Case16Result = Application.Evaluate("=XMATCH(5,{5,4,3,2,1})")
'
            If Err = 0 Then
                ThisVersionOfExcel = "Excel 365"
            Else
                Err.Clear
'
'               Test for the CONCAT function available in Excel 2019
                Case16Result = Application.Evaluate("=CONCAT(""A"",""B"")")
'
                If Err = 0 Then
                    ThisVersionOfExcel = "Excel 2019"
                Else
                    Err.Clear
                    ThisVersionOfExcel = "Excel 2016"
                End If
            End If
        Case Else:
            ThisVersionOfExcel = "Excel Unknown Version of " & ExcelVersion
    End Select
'
    MsgBox "You are running " & ThisVersionOfExcel & " build #" & Application.Build & " of " & Application.OperatingSystem & "."
'
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,858
Members
452,676
Latest member
woodyp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top