ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Compilation Based On Excel Version (https://www.excelbanter.com/excel-programming/339951-conditional-compilation-based-excel-version.html)

Josh Sale

Conditional Compilation Based On Excel Version
 
Is it possible to perform conditional compilation based on Excel version?
For example I have code that needs to continue to support XL97 but I'd like
to take advantage of new arguments to an Excel method introduced in XL2000
and later.

#If XL97 Then
abc xyz
#Else
abc xyz, lmnop
#End If

TIA

josh



Jim Cone

Conditional Compilation Based On Excel Version
 
Hi Josh,
The Vba version changed from VBA 5 to VBA 6 in Excel 2000.
New compiler constants were also created, so...

#If VBA5 Then
abc xyz
#ElseIf VBA6 Then
abc xyz, lmnop
#End If

Unfortunately, there seems to be no way to differentiate
between xl2000 and later versions using compiler constants.

Regards,
Jim Cone
San Francisco, USA


"Josh Sale" <jsale@tril dot cod
wrote in message

Is it possible to perform conditional compilation based on Excel version?
For example I have code that needs to continue to support XL97 but I'd like
to take advantage of new arguments to an Excel method introduced in XL2000
and later.

#If XL97 Then
abc xyz
#Else
abc xyz, lmnop
#End If
TIA
josh



Chip Pearson

Conditional Compilation Based On Excel Version
 
#If VBA5 Then

There is no VBA5 compiler constant.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Jim Cone" wrote in message
...
Hi Josh,
The Vba version changed from VBA 5 to VBA 6 in Excel 2000.
New compiler constants were also created, so...

#If VBA5 Then
abc xyz
#ElseIf VBA6 Then
abc xyz, lmnop
#End If

Unfortunately, there seems to be no way to differentiate
between xl2000 and later versions using compiler constants.

Regards,
Jim Cone
San Francisco, USA


"Josh Sale" <jsale@tril dot cod
wrote in message

Is it possible to perform conditional compilation based on
Excel version?
For example I have code that needs to continue to support XL97
but I'd like
to take advantage of new arguments to an Excel method
introduced in XL2000
and later.

#If XL97 Then
abc xyz
#Else
abc xyz, lmnop
#End If
TIA
josh





Jim Cone

Conditional Compilation Based On Excel Version
 
Chip,

Thanks Chip, you are so right.
That code should read...

#If VBA6 Then
abc xyz, lmnop
#Else
abc xyz
#End If

Regards,
Jim Cone


"Chip Pearson"
wrote in message
...
#If VBA5 Then


There is no VBA5 compiler constant.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




Josh Sale

Conditional Compilation Based On Excel Version
 
Thanks!

Exactly what I needed!!

josh




All times are GMT +1. The time now is 10:15 AM.

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