How to automatically covert excel version by coding
Hi,
Say you want to sort a range but the Range.Sort method either doesn't exist
or has different parameter lists depending of the XL version. You could then
use a general Object data type instead of a Range. This will make the code
compile properly.
Dim obj as Object
Dim version as string
version=application.Version
set obj = Activesheet.Range("A1:F100") ''' range to sort
if Version= "9" then
obj.Sort ..... xl2k: with a specific list of parameters
elseif version="10" or version ="11"
obj.Sort .... xl 2002 & xl 2003: with another list of parameters
elseif version ="12"
obj.Sort ..... xl 2007... same idea
else ''' prior to xl2k
''' let's say Range.Sort doesn't exist prior to 2k then write your
own code here
''' or pop a message to the user saying it cannot be done in this
version
''' <code
end if
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
"copycat" wrote:
I have some excel5 files to work on,
but some function only works in newer version.
so how do covert excel version, say use "saveas"?
any clue?thanks
|