View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_2_] Dave Peterson[_2_] is offline
external usenet poster
 
Posts: 420
Default Compiling Error in Earlier Version of Excel

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