Detecting version of Excel being used

J

jim37055

I have a VBA program that I generated in Excel 2003 that will also b
run by users who are still stuck with 97 and 2000. As part of th
program, I generate some pivot tables. The problem is that the cod
for generating the pivot tables has to be different for 97 and 200
users. My current solution is to pop up a message box asking them i
they are using 2003, and if they answer "NO" then I call the code fo
generating the pivot tables in 97/2000 format. The problem is tha
some of the folks using this program will not know if they are usin
2003 or not.

Is there a VBA statement or a function out there that will tell m
automatically what version of Excel the current user is running so tha
I do not have to rely on asking them and them actually knowing??
 
G

Gary''s Student

MsgBox "Welcome to Microsoft Excel version " & _
Application.Version & " running on " & _
Application.OperatingSystem & "!"
 
M

moondark

Hi there,

In VBA there's a property of -ApplicationObject- called Version.
In Excel 2000 it returns 9.0 for some reason. You'd have to check the
ReturnValues of each Excel version you're interested in somewhere on
the net.
Then an IF-Statement would do, I think.

Code:
--------------------
If(Application.version = "9.0") then call excel2000_code
--------------------

don't forget to insert the following ;)

Code:
--------------------
if(Application.version = "4.0") then msgbox("Phew, you should buy a new version of Excel, me, the little bothering HelpBot, suggests!")

--------------------


Regards,

Simon
 
J

jim37055

Thanks Simon,

I figured there had to be something like that out there.... I think
our installed base only includes 97, 2000 and 2003 so it should not be
too hard to figure out what values they return.
 
Top