PDA

View Full Version : Solved: detect which version of excel is running



austenr
08-13-2007, 09:12 AM
Is there a way using the workbook open event to tell which version of excel is opening the workbook then display it in a message box?

Bob Phillips
08-13-2007, 09:30 AM
Private Sub Workbook_Open()
Select Case Val(Application.Version)
Case 12: MsgBox "Excel 2007"
Case 11: MsgBox "Excel 2003"
Case 10: MsgBox "Excel 2002/XP"
Case 9: MsgBox "Excel 2000"
End Select
End Sub

austenr
08-13-2007, 09:34 AM
Thanks bob. Spot on as usual.

Bob Phillips
08-13-2007, 09:36 AM
There should be a format for version shouldn't there? Something like



Msgbox Format(Val(Application.Version),xlVersion)


<BG>

austenr
08-13-2007, 09:42 AM
What I am after is that this workbook could potentially be opened on any machine using excel. Depending on what version opens it (in this case 2003 or 2007) the user will be prompted to use a different version of instructions to install missing addins. This is a project I am doing for a university which is migrating from 2003 to 2007. It can be done on campus or taken home to do. So the message box would say:

"You are running Excel 2003, please use the instructions that pertain to that version to install the addins." Likewise for 2007.