PDA

View Full Version : Solved: Identify which Excel version via Code



ronjon65
03-09-2012, 06:40 PM
Is there some that would identify which Excel version is being used? I want a to create a message that says which version

- Excel 2000, 2003, 2007, 2010
- If 2010 identify if it is the 32 bit or 64 bit.

This way I can let the user know if they are using a compatible version. My code currently does not support 2000 (or prior) nor does it support 2010 64 bit. A pop up message stating the version and a "Success" or "Failure" note would be great.

Kenneth Hobs
03-09-2012, 08:49 PM
For 32 or 64 bit see: http://www.cpearson.com/Excel/Bitness.aspx

For version, do:
MsgBox Val(Application.Version)

mikerickson
03-09-2012, 08:49 PM
have you looked at Application.Version?

Also, scroll down to the conditional compilation section of
http://msdn.microsoft.com/en-us/library/ee691831.aspx

ronjon65
03-10-2012, 09:13 AM
Great job guys. Looks good.

My revised plan is to not start the spreadsheet (Workbook Open) unless an authorized version is detected. A message box would also come up and state the supported and unsupported version.

One question, Chip's code will detect if it is Excel 64 bit via the "Win64" detection. Is is safe to assume that is is 32 bit if "Win64" is not detected?

Kenneth Hobs
03-10-2012, 09:33 AM
I run Vista64Home with 32 bit Excel2012. This shows false.


Sub Test_Is64BitExcel()
MsgBox Is64BitExcel
End Sub

Function Is64BitExcel() As Boolean
#If VBA7 And Win64 Then
Is64BitExcel = True
#Else
Is64BitExcel = False
#End If
End Function

ronjon65
03-10-2012, 10:22 AM
Thanks for the data point. It works as expected on 2003 as well. I need to get a new machine with a 64 bit Excel version.

Is your 2012 a beta?