View Single Post
  #10   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

Not on a sub/function level, but on the module level. So if you keep your
version dependent stuff in a separate module, you should be close to ok <vbg.

On 12/11/2011 11:55, Tim Childs wrote:
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 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




--
Dave Peterson