![]() |
How to automatically covert excel version by coding
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 |
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 |
All times are GMT +1. The time now is 11:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com