View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tim Childs[_4_] Tim Childs[_4_] is offline
external usenet poster
 
Posts: 31
Default Compiling Error in Earlier Version of Excel

Hi Dave

thanks for those options - so the compiler only compiles as it goes, on a
"need be" basis i.e. compiling the next used sub or function etc.?

Thx for warning about manual compiling - as I like to do that :)

bw

Tim



"Dave Peterson" wrote in message
...
You could put the sub/function in its own module and call it only when
you're running the version of excel that supports it (using the if
statement in other posts).

But it'll be up to you to not try to compile the code manually, too!

Another way is to use something like:

Dim VarThisWorkbook as Object 'not usually a nice declaration!

set Varthisworkbook = thisworkbook

if runningthecorrectversion then
varthisworkbook.forcefullcalculation = true
end if

(All untested, uncompiled -- watch for typos!)

On 12/10/2011 03:48, Tim Childs wrote:
Hi

This piece of code
ThisWorkbook.ForceFullCalculation = True
will work in Excel 2007 and above

Is there any way to mark the code so that it will avoid the COMPILING
error
in earlier versions where this functionality was not available? (I use
the
file in different versions of Excel)

Many thanks

Tim



--
Dave Peterson