ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Detecting version of Excel being used (https://www.excelbanter.com/excel-discussion-misc-queries/48959-detecting-version-excel-being-used.html)

jim37055

Detecting version of Excel being used
 

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

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


--
jim37055
------------------------------------------------------------------------
jim37055's Profile: http://www.excelforum.com/member.php...o&userid=27788
View this thread: http://www.excelforum.com/showthread...hreadid=473755


Gary''s Student

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

--
Gary's Student


"jim37055" wrote:


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

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


--
jim37055
------------------------------------------------------------------------
jim37055's Profile: http://www.excelforum.com/member.php...o&userid=27788
View this thread: http://www.excelforum.com/showthread...hreadid=473755



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


--
moondark
------------------------------------------------------------------------
moondark's Profile: http://www.excelforum.com/member.php...o&userid=27390
View this thread: http://www.excelforum.com/showthread...hreadid=473755


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.


--
jim37055
------------------------------------------------------------------------
jim37055's Profile: http://www.excelforum.com/member.php...o&userid=27788
View this thread: http://www.excelforum.com/showthread...hreadid=473755



All times are GMT +1. The time now is 07:52 PM.

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