Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am writing a VBA macro in Excel 2000 and would like to check the version number of Excel as a first step. (I have some users with Excel 2000, and others with XP & 2003.) Is there a simple way to do this in VBA code? Thanks.
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mark,
Use Val(Application.Version) Walk has a list of them at http://www.j-walk.com/ss/excel/index.htm -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "MarkFL" wrote in message ... I am writing a VBA macro in Excel 2000 and would like to check the version number of Excel as a first step. (I have some users with Excel 2000, and others with XP & 2003.) Is there a simple way to do this in VBA code? Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob Phillips wrote:
Mark, Use Val(Application.Version) Walk has a list of them at http://www.j-walk.com/ss/excel/index.htm Is the Val necessary? Application.Version seems to work. I.e., in my xl2000 Application.Version < 9 returns False Application.Version = 9 returns True Application.Version 9 returns False Are there some pitfalls to using it without coercing to a double? Alan Beban |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not come across any Alan, just that Help describes Version as a read-only
string. Defensive programming again. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Alan Beban" wrote in message ... Bob Phillips wrote: Mark, Use Val(Application.Version) Walk has a list of them at http://www.j-walk.com/ss/excel/index.htm Is the Val necessary? Application.Version seems to work. I.e., in my xl2000 Application.Version < 9 returns False Application.Version = 9 returns True Application.Version 9 returns False Are there some pitfalls to using it without coercing to a double? Alan Beban |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob,
Can the code be modified so that it returns a value such as (9.0.2720) instead of just (9)? TIA "Bob Phillips" wrote in message ... Not come across any Alan, just that Help describes Version as a read-only string. Defensive programming again. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Alan Beban" wrote in message ... Bob Phillips wrote: Mark, Use Val(Application.Version) Walk has a list of them at http://www.j-walk.com/ss/excel/index.htm Is the Val necessary? Application.Version seems to work. I.e., in my xl2000 Application.Version < 9 returns False Application.Version = 9 returns True Application.Version 9 returns False Are there some pitfalls to using it without coercing to a double? Alan Beban |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Alan Beban" skrev i melding
... Val(Application.Version) Is the Val necessary? Definitely. Application.Version returns a string. Except from type mismatches, "10" is smaller than "9". ?"11""9" False HTH. Best wishes Harald |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Harald,
I'm not following what you're saying. In my xl2000 (Version 9) Application.Version = 9 returns True Application.Version = 11 returns False Application.Version < 11 returns True and Application.Version 11 returns False What's the problem again with using these to test a Version number? Alan Beban Harald Staff wrote: "Alan Beban" skrev i melding ... Val(Application.Version) Is the Val necessary? Definitely. Application.Version returns a string. Except from type mismatches, "10" is smaller than "9". ?"11""9" False HTH. Best wishes Harald |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Alan,
The real problem (although admittedly I haven't seen it since Excel 97) is that Microsoft would append letters onto the end of the version number to indicate the service pack. So if you check Application.Version on Excel 97 SR2 it comes back as "8.0e". This will obviously fail in any numeric comparisons unless you use Val to coerce it into a number. -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * "Alan Beban" wrote in message ... Hi Harald, I'm not following what you're saying. In my xl2000 (Version 9) Application.Version = 9 returns True Application.Version = 11 returns False Application.Version < 11 returns True and Application.Version 11 returns False What's the problem again with using these to test a Version number? Alan Beban Harald Staff wrote: "Alan Beban" skrev i melding ... Val(Application.Version) Is the Val necessary? Definitely. Application.Version returns a string. Except from type mismatches, "10" is smaller than "9". ?"11""9" False HTH. Best wishes Harald |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Alan Beban" skrev i melding
... Hi Harald, I'm not following what you're saying. In my xl2000 (Version 9) Application.Version = 9 returns True Application.Version = 11 returns False Application.Version < 11 returns True and Application.Version 11 returns False What's the problem again with using these to test a Version number? Hi Alan Problem is that version is text, not number. Ran this macro in Excel2003 (v 11): Sub test() Dim Counter As Long On Error GoTo errorprint Counter = 1 If Application.Version 9 Then _ Debug.Print Counter, Application.Version & _ " newer than 9" Counter = Counter + 1 If Application.Version < 9 Then _ Debug.Print Counter, Application.Version & _ " older than 9" Counter = Counter + 1 If Application.Version "9" Then _ Debug.Print Counter, Application.Version & _ " newer than ""9""" Counter = Counter + 1 If Application.Version < "9" Then _ Debug.Print Counter, Application.Version & _ " older than ""9""" Counter = Counter + 1 If Val(Application.Version) 9 Then _ Debug.Print Counter, Val(Application.Version) & _ " newer than 9" Counter = Counter + 1 If Val(Application.Version) < 9 Then _ Debug.Print Counter, Val(Application.Version) & _ " older than 9" Exit Sub errorprint: Debug.Print Counter, Err.Number & " " & Error Resume Next End Sub and it printed this: 1 13 Type mismatch 1 11.0 newer than 9 2 13 Type mismatch 2 11.0 older than 9 4 11.0 older than "9" 5 11 newer than 9 Best wishes Harald |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
TRacking Version Number in Excel 2007 | Excel Discussion (Misc queries) | |||
how can you insert a version number in excel ? | Excel Worksheet Functions | |||
Is the Excel Version Number Embedded in a File | Excel Discussion (Misc queries) | |||
From where i can get list of all released version number of Excel | Excel Discussion (Misc queries) | |||
Recover earlier version of excel sheet after new version saved? | Excel Discussion (Misc queries) |