Compiling and Late Binding
Just my thoughts -- could be completely wrong technically. But it satisfies my
curiosity <vbg.
Excel knows all the properties and methods for ThisWorkbook just like it knows
all the properties and methods for a Range object.
But it has no idea what you're doing with a variable declared as an Object.
So no matter what version you're using if you use ThisWorkbook, excel knows --
you can't fool it.
But if you use the Object variable, excel doesn't know or care until the code
actually runs.
On 12/16/2011 05:02, Tim Childs wrote:
Hi
in the few lines of code below which was from Dave Petersen and Joe U, the use
of the Excel command ForceFullCalculation does not produce a standard
compilation error (due to late binding apparently), whereas it would if it was just
Thisworkbook.ForceFullCalculation
If Val(Application.Version) 11 Then
Set oWkBk = ThisWorkbook
oWkBk.ForceFullCalculation = True
Debug.Print "Running forced calculation"
End If
Can someone explain briefly WHY late binding applies in this area?
Many thanks
Tim
--
Dave Peterson
|