Excel Version

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

What code would i put in an Auto_Open macro to detemine the Excel version. I have written and add-in with XL2000, but half of the users have xl97 which is generating code errors. I would like CODE to just close the file unless XL2000 is being used.

Thanks for your help

Mike
 
Mike,

You need application.Version. XL2000 is 9.0, 97 was 8.0 I believe.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Mike R said:
Hi,

What code would i put in an Auto_Open macro to detemine the Excel
version. I have written and add-in with XL2000, but half of the users have
xl97 which is generating code errors. I would like CODE to just close the
file unless XL2000 is being used.
 
Excel 2000 and later defines the precomiler variable VBA6

you could put code similar to this in the workbook_open event:

Sub Tester1()
Dim bxl_2000 As Boolean
#If VBA6 Then
bxl_2000 = True
#Else
bxl_2000 = False
#End If
If Not bxl_2000 Then
ThisWorkbook.Close Savechanges:=False
End If
End Sub
 
Bob,
This wasn't meant to be posted under your post, but on the same level as an
additional method. Not meant in any way to disagree with the excellent
suggestion you made. My apologies if I created any other impression.
 
Back
Top