macro to tell people they are not using the correct version of excel

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I'm not quite sure how or if it would be possible to do this but I have problems sharing my documents with others as sometimes the functions I've used like the new filter formula do not work on their version of excel,
fortunatly this is getting less and less but trying to explain their version of excel is not new enough is a big pain,
so I was wondering if there was a way when excel opens to run a macro that checks to see if the version of excel is new enough? now as I understand it, it doesn't have to be the very newest version so I'm not sure how we could check this but any ideas would be a great help
Thanks
Tony
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
By version you mean the likes of 2016, 2013 etc? Then maybe use Application.Version ?
 
Upvote 0
Hi Micron,

AFAIK 2016, 2019, 2021, and 365 will all indicate 16.

Maybe use the Build-Number_

VBA Code:
Public Sub test()
'https://stackoverflow.com/questions/31718490/finding-ms-office-revision-and-build-version-using-vba
  Dim version As String
  Dim chkref As Object
  Dim major As String
  Dim majorup As String
  Dim minor As String
  Dim minorup As String

  ' List of references
  For Each chkref In ThisWorkbook.VBProject.References
    version = RetrieveDllVersion(chkref.fullpath)
    major = RetrievePart(version, 0)
    majorup = RetrievePart(version, 1)
    minor = RetrievePart(version, 2)
    minorup = RetrievePart(version, 3)
    If chkref.Name = "Excel" Then
      MsgBox chkref.Name & " : " & major & "." & majorup & "." & minor & "." & minorup
    End If
  Next chkref
End Sub

Private Function RetrieveDllVersion(ByVal dll As String) As String
  Dim fso As Object 'Scripting.FileSystemObject
  Set fso = CreateObject("Scripting.FileSystemObject")
  RetrieveDllVersion = fso.GetFileVersion(dll)
End Function

Private Function RetrievePart(ByVal version As String, ByVal pos As Integer) As String
  RetrievePart = Split(version, ".")(pos)
End Function

Holger
 
Upvote 0
This will show if the user has 2021 or 365
VBA Code:
Private Sub Workbook_Open()
   Dim x As Variant
   
   On Error Resume Next
   x = Application.Sequence(10)
   On Error GoTo 0
   If IsArray(x) Then
      MsgBox "Ok"
   Else
      MsgBox "Too old"
   End If
End Sub
 
Upvote 0
Brilliant, thank you to all of you for your help,
fluff, i think your idea is brilliant,
thanks
Tony
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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