ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Version Trap (https://www.excelbanter.com/excel-programming/301250-excel-version-trap.html)

amescha

Excel Version Trap
 
Hello All,

I am looking for a listing of MS Excel verions (releases). I have searched "all of Microsoft.com" to no avail. Specifically I want to keep a VBA procedure from running if the user has anything less than releases 9.0x or 10.0x. The procedure creates a Pivot Table and Pivot Chart which requires the aforesaid two versions. I was considering using a Select Case statement that would result in an appropriate message box and "Exit Sub" unless a version that handles Pivot Charts is being used. Thanks in Advance!

Norman Jones

Excel Version Trap
 
Hi Amescha,

Possibly, something like:

If CDbl(Application.Version) = 9 Then
'Run your pivot table
Else
'Dont!
End If


---
Regards,
Norman
"amescha" wrote in message
...
Hello All,

I am looking for a listing of MS Excel verions (releases). I have searched

"all of Microsoft.com" to no avail. Specifically I want to keep a VBA
procedure from running if the user has anything less than releases 9.0x or
10.0x. The procedure creates a Pivot Table and Pivot Chart which requires
the aforesaid two versions. I was considering using a Select Case statement
that would result in an appropriate message box and "Exit Sub" unless a
version that handles Pivot Charts is being used. Thanks in Advance!



Gord Dibben

Excel Version Trap
 
If Application.Version < "9.0" Then
MsgBox "This utility will not work in your version of Excel. " & _
"You must upgrade to version 9.0.", vbExclamation
End
End If

Gord Dibben Excel MVP

On Fri, 11 Jun 2004 18:38:01 -0700, "amescha"
wrote:

Hello All,

I am looking for a listing of MS Excel verions (releases). I have searched "all of Microsoft.com" to no avail. Specifically I want to keep a VBA procedure from running if the user has anything less than releases 9.0x or 10.0x. The procedure creates a Pivot Table and Pivot Chart which requires the aforesaid two versions. I was considering using a Select Case statement that would result in an appropriate message box and "Exit Sub" unless a version that handles Pivot Charts is being used. Thanks in Advance!



thai

Excel Version Trap
 
Try:
if application.version 8.0 then exit sub

I'm not sure if it works, though

thai

Excel Version Trap
 
Let me repost it:

If application.version < 9 then exit sub
call PVT
..
..
..
..
..
Sub PVT()
'you put your Pivot Table and Pivot Chart things here
'in a seperate Sub
'Because if you include Pivot things up, then Excel 97
wouldn't run
End Sub

amescha

Excel Version Trap
 


"Gord Dibben" wrote:

If Application.Version < "9.0" Then
MsgBox "This utility will not work in your version of Excel. " & _
"You must upgrade to version 9.0.", vbExclamation
End
End If

Gord Dibben Excel MVP

Dear Gord,

Well this code works fine on the current platform that I am using, namely excel version 8.0e. I will not have the opportunity to try version 9.0x & 10.0x until next week. Stay tuned.
My question here is that I am given to understand that the application.version
property returns a String. It is obvious that string "values" are being compared here. The question then becomes what happens when I try this on a 10.0x platform. When I type =IF(H3<I3,TRUE,FALSE) on a worksheet and enter 8.0e in cell H3 and 9.0x in cell I3 I see a TRUE but when cell I3 becomes 10.0z or 10 as a number then I see FALSE.
Could you please elaborate if you have the time?
Thanks in advance - again
amescha

Gord Dibben

Excel Version Trap
 
Application.Version returns a numeric, not a string.

It does not differentiate between releases(x,y,z etc.)as far as I can tell.

Sub version()
Range("A1").Value = Application.Version
End Sub

=ISNUMBER(A1) returns TRUE

Tested on versions 8.0, 10.0 and 11.0

Don't know how we got from VBA to worksheet Functions....

Your original question was......

I am looking for a listing of MS Excel verions (releases). I have searched
"all of Microsoft.com" to no avail. Specifically I want to keep a VBA
procedure from running if the user has anything less than releases 9.0x or
10.0x. The procedure creates a Pivot Table and Pivot Chart which requires the
aforesaid two versions. I was considering using a Select Case statement that
would result in an appropriate message box and "Exit Sub" unless a version
that handles Pivot Charts is being used. Thanks in Advance!

Gord




On Sat, 12 Jun 2004 15:26:01 -0700, "amescha"
wrote:



"Gord Dibben" wrote:

If Application.Version < "9.0" Then
MsgBox "This utility will not work in your version of Excel. " & _
"You must upgrade to version 9.0.", vbExclamation
End
End If

Gord Dibben Excel MVP

Dear Gord,

Well this code works fine on the current platform that I am using, namely excel version 8.0e. I will not have the opportunity to try version 9.0x & 10.0x until next week. Stay tuned.
My question here is that I am given to understand that the application.version
property returns a String. It is obvious that string "values" are being compared here. The question then becomes what happens when I try this on a 10.0x platform. When I type =IF(H3<I3,TRUE,FALSE) on a worksheet and enter 8.0e in cell H3 and 9.0x in cell I3 I see a TRUE but when cell I3 becomes 10.0z or 10 as a number then I see FALSE.
Could you please elaborate if you have the time?
Thanks in advance - again
amescha



Dave Peterson[_3_]

Excel Version Trap
 
I think your test depends on going back to excel's worksheet. And then excel's
parser takes over and sees that entry as numeric.

But if you stay in VBA:
Option Explicit
Sub testme()

Dim myArr As Variant
Dim iCtr As Long
myArr = Array(3.3, "3.3", Application.Version, Val(Application.Version))

Debug.Print "Ctr Val VBA FromWks"
For iCtr = LBound(myArr) To UBound(myArr)
ActiveSheet.Range("a1").Value = myArr(iCtr)
Debug.Print iCtr & "--" & myArr(iCtr) & "--" & TypeName(myArr(iCtr)) _
& "--" & Application.IsNumber(ActiveSheet.Range("a1").Value )
Next iCtr

End Sub
Returned:
Ctr Val VBA FromWks
0--3.3--Double--True
1--3.3--String--True
2--10.0--String--True
3--10--Double--True



Gord Dibben wrote:

Application.Version returns a numeric, not a string.

It does not differentiate between releases(x,y,z etc.)as far as I can tell.

Sub version()
Range("A1").Value = Application.Version
End Sub

=ISNUMBER(A1) returns TRUE

Tested on versions 8.0, 10.0 and 11.0

Don't know how we got from VBA to worksheet Functions....

Your original question was......

I am looking for a listing of MS Excel verions (releases). I have searched
"all of Microsoft.com" to no avail. Specifically I want to keep a VBA
procedure from running if the user has anything less than releases 9.0x or
10.0x. The procedure creates a Pivot Table and Pivot Chart which requires the
aforesaid two versions. I was considering using a Select Case statement that
would result in an appropriate message box and "Exit Sub" unless a version
that handles Pivot Charts is being used. Thanks in Advance!

Gord

On Sat, 12 Jun 2004 15:26:01 -0700, "amescha"
wrote:



"Gord Dibben" wrote:

If Application.Version < "9.0" Then
MsgBox "This utility will not work in your version of Excel. " & _
"You must upgrade to version 9.0.", vbExclamation
End
End If

Gord Dibben Excel MVP

Dear Gord,

Well this code works fine on the current platform that I am using, namely excel version 8.0e. I will not have the opportunity to try version 9.0x & 10.0x until next week. Stay tuned.
My question here is that I am given to understand that the application.version
property returns a String. It is obvious that string "values" are being compared here. The question then becomes what happens when I try this on a 10.0x platform. When I type =IF(H3<I3,TRUE,FALSE) on a worksheet and enter 8.0e in cell H3 and 9.0x in cell I3 I see a TRUE but when cell I3 becomes 10.0z or 10 as a number then I see FALSE.
Could you please elaborate if you have the time?
Thanks in advance - again
amescha


--

Dave Peterson


Gord Dibben

Excel Version Trap
 
Thanks Dave

Over my head, but will look at it and try to decipher.

Gord

On Sun, 13 Jun 2004 05:51:09 -0500, Dave Peterson wrote:

I think your test depends on going back to excel's worksheet. And then excel's
parser takes over and sees that entry as numeric.

But if you stay in VBA:
Option Explicit
Sub testme()

Dim myArr As Variant
Dim iCtr As Long
myArr = Array(3.3, "3.3", Application.Version, Val(Application.Version))

Debug.Print "Ctr Val VBA FromWks"
For iCtr = LBound(myArr) To UBound(myArr)
ActiveSheet.Range("a1").Value = myArr(iCtr)
Debug.Print iCtr & "--" & myArr(iCtr) & "--" & TypeName(myArr(iCtr)) _
& "--" & Application.IsNumber(ActiveSheet.Range("a1").Value )
Next iCtr

End Sub
Returned:
Ctr Val VBA FromWks
0--3.3--Double--True
1--3.3--String--True
2--10.0--String--True
3--10--Double--True



Gord Dibben wrote:

Application.Version returns a numeric, not a string.

It does not differentiate between releases(x,y,z etc.)as far as I can tell.

Sub version()
Range("A1").Value = Application.Version
End Sub

=ISNUMBER(A1) returns TRUE

Tested on versions 8.0, 10.0 and 11.0

Don't know how we got from VBA to worksheet Functions....

Your original question was......

I am looking for a listing of MS Excel verions (releases). I have searched
"all of Microsoft.com" to no avail. Specifically I want to keep a VBA
procedure from running if the user has anything less than releases 9.0x or
10.0x. The procedure creates a Pivot Table and Pivot Chart which requires the
aforesaid two versions. I was considering using a Select Case statement that
would result in an appropriate message box and "Exit Sub" unless a version
that handles Pivot Charts is being used. Thanks in Advance!

Gord

On Sat, 12 Jun 2004 15:26:01 -0700, "amescha"
wrote:



"Gord Dibben" wrote:

If Application.Version < "9.0" Then
MsgBox "This utility will not work in your version of Excel. " & _
"You must upgrade to version 9.0.", vbExclamation
End
End If

Gord Dibben Excel MVP

Dear Gord,

Well this code works fine on the current platform that I am using, namely excel version 8.0e. I will not have the opportunity to try version 9.0x & 10.0x until next week. Stay tuned.
My question here is that I am given to understand that the application.version
property returns a String. It is obvious that string "values" are being compared here. The question then becomes what happens when I try this on a 10.0x platform. When I type =IF(H3<I3,TRUE,FALSE) on a worksheet and enter 8.0e in cell H3 and 9.0x in cell I3 I see a TRUE but when cell I3 becomes 10.0z or 10 as a number then I see FALSE.
Could you please elaborate if you have the time?
Thanks in advance - again
amescha



Tom Ogilvy

Excel Version Trap
 
? application.Version
8.0e

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
I think your test depends on going back to excel's worksheet. And then

excel's
parser takes over and sees that entry as numeric.

But if you stay in VBA:
Option Explicit
Sub testme()

Dim myArr As Variant
Dim iCtr As Long
myArr = Array(3.3, "3.3", Application.Version,

Val(Application.Version))

Debug.Print "Ctr Val VBA FromWks"
For iCtr = LBound(myArr) To UBound(myArr)
ActiveSheet.Range("a1").Value = myArr(iCtr)
Debug.Print iCtr & "--" & myArr(iCtr) & "--" &

TypeName(myArr(iCtr)) _
& "--" & Application.IsNumber(ActiveSheet.Range("a1").Value )
Next iCtr

End Sub
Returned:
Ctr Val VBA FromWks
0--3.3--Double--True
1--3.3--String--True
2--10.0--String--True
3--10--Double--True



Gord Dibben wrote:

Application.Version returns a numeric, not a string.

It does not differentiate between releases(x,y,z etc.)as far as I can

tell.

Sub version()
Range("A1").Value = Application.Version
End Sub

=ISNUMBER(A1) returns TRUE

Tested on versions 8.0, 10.0 and 11.0

Don't know how we got from VBA to worksheet Functions....

Your original question was......

I am looking for a listing of MS Excel verions (releases). I have

searched
"all of Microsoft.com" to no avail. Specifically I want to keep a VBA
procedure from running if the user has anything less than releases 9.0x

or
10.0x. The procedure creates a Pivot Table and Pivot Chart which

requires the
aforesaid two versions. I was considering using a Select Case statement

that
would result in an appropriate message box and "Exit Sub" unless a

version
that handles Pivot Charts is being used. Thanks in Advance!

Gord

On Sat, 12 Jun 2004 15:26:01 -0700, "amescha"
wrote:



"Gord Dibben" wrote:

If Application.Version < "9.0" Then
MsgBox "This utility will not work in your version of Excel. "

& _
"You must upgrade to version 9.0.", vbExclamation
End
End If

Gord Dibben Excel MVP

Dear Gord,

Well this code works fine on the current platform that I am using,

namely excel version 8.0e. I will not have the opportunity to try version
9.0x & 10.0x until next week. Stay tuned.
My question here is that I am given to understand that the

application.version
property returns a String. It is obvious that string "values" are being

compared here. The question then becomes what happens when I try this on a
10.0x platform. When I type =IF(H3<I3,TRUE,FALSE) on a worksheet and enter
8.0e in cell H3 and 9.0x in cell I3 I see a TRUE but when cell I3 becomes
10.0z or 10 as a number then I see FALSE.
Could you please elaborate if you have the time?
Thanks in advance - again
amescha


--

Dave Peterson




Harald Staff

Excel Version Trap
 
Be careful here folks. Application.Version returns a String value. Sort
strings and you get a list like
1
10
11
2
20

So for Excel versions:

Sub test()
MsgBox "8.0" < "9.0" 'true
MsgBox "9.0" < "9.0" 'false
MsgBox "10.0" < "9.0" 'true
MsgBox "11.0" < "9.0" 'true
End Sub

HTH. Best wishes Harald


"amescha" skrev i melding
...
Hello All,

I am looking for a listing of MS Excel verions (releases). I have searched

"all of Microsoft.com" to no avail. Specifically I want to keep a VBA
procedure from running if the user has anything less than releases 9.0x or
10.0x. The procedure creates a Pivot Table and Pivot Chart which requires
the aforesaid two versions. I was considering using a Select Case statement
that would result in an appropriate message box and "Exit Sub" unless a
version that handles Pivot Charts is being used. Thanks in Advance!



amescha

Excel Version Trap
 


"amescha" wrote:

Hello All,

I am looking for a listing of MS Excel verions (releases). I have searched "all of Microsoft.com" to no avail. Specifically I want to keep a VBA procedure from running if the user has anything less than releases 9.0x or 10.0x. The procedure creates a Pivot Table and Pivot Chart which requires the aforesaid two versions. I was considering using a Select Case statement that would result in an appropriate message box and "Exit Sub" unless a version that handles Pivot Charts is being used. Thanks in Advance!


I have come up with a solution to my own problem, perhaps not the most elegant but it does work on versions 8.0x, 9.0x and 10.0x, the relevant part of the code is:

Dim VersionString As String
Dim VersionNumber As Double
VersionString = Application.Version
VersionNumber = Val(VersionString)
MsgBox "This is MS Excel version " & VersionNumber
If VersionNumber = 9 Then
MsgBox "Go ahead and build your Pivot Chart"
Else
MsgBox "Sorry, this version does not support Pivot Charts!"
Exit Sub
End If

Still I welcome further comment,

amescha

Alan Beban[_2_]

Excel Version Trap
 
Is there a problem with eliminating VersionString and VersionNumber and
simply using

If Application.Version = 9

Alan Beban

amescha wrote:


"amescha" wrote:


Hello All,

I am looking for a listing of MS Excel verions (releases). I have searched "all of Microsoft.com" to no avail. Specifically I want to keep a VBA procedure from running if the user has anything less than releases 9.0x or 10.0x. The procedure creates a Pivot Table and Pivot Chart which requires the aforesaid two versions. I was considering using a Select Case statement that would result in an appropriate message box and "Exit Sub" unless a version that handles Pivot Charts is being used. Thanks in Advance!



I have come up with a solution to my own problem, perhaps not the most elegant but it does work on versions 8.0x, 9.0x and 10.0x, the relevant part of the code is:

Dim VersionString As String
Dim VersionNumber As Double
VersionString = Application.Version
VersionNumber = Val(VersionString)
MsgBox "This is MS Excel version " & VersionNumber
If VersionNumber = 9 Then
MsgBox "Go ahead and build your Pivot Chart"
Else
MsgBox "Sorry, this version does not support Pivot Charts!"
Exit Sub
End If

Still I welcome further comment,

amescha



All times are GMT +1. The time now is 03:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com