To me, it looks like the only API difference between Excel >= 2010 and < 2010 is the DisplayFormat property, which must be used only for >= 2010. How about:
Function DisplayFormat(ByVal cell As Cell) As Object
If Excel2010 Then
Set DisplayFormat = cell.DisplayFormat
Else
Set DisplayFormat = cell
End If
End Function
For better IntelliSense, perhaps we'd also want to wrap the properties we're accessing. Or use a full-blown interface with two implementations.
To me, it looks like the only API difference between Excel >= 2010 and < 2010 is the
DisplayFormat
property, which must be used only for >= 2010. How about:For better IntelliSense, perhaps we'd also want to wrap the properties we're accessing. Or use a full-blown interface with two implementations.
Would the preprocessor work, too? http://stackoverflow.com/q/6325486/946850