Compatibility check to run programmatically

James_Latimer

Active Member
Joined
Jan 20, 2009
Messages
415
Office 2016 / Win 10

Hi all,

I appreciate that this is a stupid question (given how easy it is to run the compatibility check from Excel front end)...

I am constantly having to dumb down Excel for staff and was hoping there would be a way that i can run the compatibility checker programmatically...is this possible? Quite a few of our workbooks go to people using old versions of Office.

It would be nice if the user could select the version of Office to check for and then output a list of potential issues (if at all any). I won't need the entire code writing for me, but some pointers would be awesome.

Any information would be genuinely appreciated.

Thanks in advance.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You can determine the Excel version using Application.Version. You can determine the version of the Visual Basic Engine by looking at Application.VBE.Version. If a section of your code uses a feature not supported in the earlier version of Excel, you could use a Select Case Application.Version to perform an alternate operation in that case.
Code:
Option Explicit

Public Function AppVersion() As Double
    AppVersion = CDbl(Application.Version)
End Function

Public Function VersionName(Optional Version As Double = -1#) As String
    If Version < 0# Then
        Version = AppVersion
    End If
    ' There was no version 6 nor 13.
    Select Case Version
    Case 5#
        VersionName = Application.Name & " 5"
    Case 7#
        VersionName = Application.Name & " 95"
    Case 8#
        VersionName = Application.Name & " 97"
    Case 9
        VersionName = Application.Name & " 2000"
    Case 10
        VersionName = Application.Name & " 2002"
    Case 11
        VersionName = Application.Name & " 2003"
    Case 12
        VersionName = Application.Name & " 2007"
    Case 14
        VersionName = Application.Name & " 2010"
    Case 15
        VersionName = Application.Name & " 2013"
    Case 16
        VersionName = Application.Name & " 2016"
    Case Else
        VersionName = "Unknown " & Application.Name & " Version"
    End Select
End Function

Public Function VBVersion() As Double
    VBVersion = Val(Application.VBE.Version)
End Function
 
Upvote 0
Thanks Nutster!

Although the code you kindly provided wouldn't be of much use to me in this particular instance... i certainly will be able to use it elsewhere. Thank you very much for your input, i genuinely appreciate you taking the time to reply to me.

I was more hoping to automate the process of checking for functions that wont work in older versions or certain chart types that aren't supported etc.

Thanks again!
 
Upvote 0
To check the version so you can bypass new features in old versions of the software.
Code:
Select Case CDbl(Application.Version)
Case Is >= 14.0  ' Excel 2010
  '  Whatever was introduced in Office 2010
Case Else
  ' How to work around stuff that was not available until later.
End Select
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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