Reputation: 23
I create excel application that have password protection on sheets. What I want to do is restrict user from saving file when they open using older version of excel that does not have password protect feature. Older than 2003. Is this achievable. Thanks on advance.
Upvotes: 2
Views: 57
Reputation: 1316
This is a code to check version of Excel and it cancel the save if the version is older :
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim xl_version As Integer
xl_version = VBA.Val(Application.Version)
If xl_version < 11 Then
Cancel = True
MsgBox "Your Excel version is too old"
End If
End Sub
List of Excel version :
8: "Excel 97"
9: "Excel 2000"
10: "Excel 2002"
11: "Excel 2003"
12: "Excel 2007"
14: "Excel 2010"
15: "Excel 2013"
16: "Excel 2016"
Upvotes: 2