Conditional compiling between Excel Versions

  • Thread starter Thread starter Ken Soenen
  • Start date Start date
K

Ken Soenen

The program that I am writing using Excel 2003 is spread over many modules
and is not totally compatible with Excel 2000. I get compiler errors in many
modules. My question is: how is this normally handled? I can use the
compiler constants #Const and its associated #IF statement to conditionally
compile certain pieces of code, but the Constant has to be defined in EVERY
module that you're going to use it in and then has to be manually changed
when you get the code over to the destination machine(Excel Version). It all
seems pretty cumbersome to me. Am I missing something here?? Other than a
few brain cells!!!



thanks,

ken
 
Grüezi Ken

Ken Soenen schrieb am 03.03.2006
The program that I am writing using Excel 2003 is spread over many modules
and is not totally compatible with Excel 2000. I get compiler errors in many
modules. My question is: how is this normally handled? I can use the
compiler constants #Const and its associated #IF statement to conditionally
compile certain pieces of code, but the Constant has to be defined in EVERY
module that you're going to use it in and then has to be manually changed
when you get the code over to the destination machine(Excel Version). It all
seems pretty cumbersome to me. Am I missing something here?? Other than a
few brain cells!!!

You could use 'Applicaion.Version' to find out which verion of Excel is
running.
In an If-statemend you have the diffenrent code for each version.



Regards
Thomas Ramel
 
Hi Ken,

The conventional advice would be to develop the application in the lowest
version which, it is anticipated, it will be used.

This does not preclude the possible use of conditional compilation to
provide additional functionality to users of later versions.
 
It doesn't have to be defined in every module, you can add a global
conditional constant in the project properties, General tab.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Bob,
Thanks for responding. Can you expand a bit on how to find the
"General tab". The only thing I can find is "General" under the options...
Also, couldn't see anything in the project properties window.

thanks,
ken
 
Select the project in the project explorer within the VBIDE, and then
Tools>VBAProject Properties (assuming that you haven't renamed your
project), and on the General tab, at the bottom is a box labelled
Conditional Compilation Arguments. Add a conditional variable and value in
there.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
General is it. Does it have a textbox at the bottom named Conditional
Compilation Arguments

Note: "General" appears on one of the two "tabs"
 
That does it. Thanks a bunch guys.

ken

Bob Phillips said:
Select the project in the project explorer within the VBIDE, and then
Tools>VBAProject Properties (assuming that you haven't renamed your
project), and on the General tab, at the bottom is a box labelled
Conditional Compilation Arguments. Add a conditional variable and value in
there.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Back
Top