ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Version (https://www.excelbanter.com/excel-programming/289591-excel-version.html)

Mike R[_2_]

Excel Version
 
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

Bob Phillips[_6_]

Excel Version
 
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" wrote in message
...
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




Tom Ogilvy

Excel Version
 
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

--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
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" wrote in message
...
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






Tom Ogilvy

Excel Version
 
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.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
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

--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
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" wrote in message
...
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









All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com