I bet that there are people running versions of excel that include a letter
suffix (xl2002 and prior).
I'd use something like:
if val(application.version) = 12 then
And to save typing
select case val(application.version)
case is = 12 : msgbox "you are using xl2007"
case is = 11 : msgbox "you are using xl2003"
...
end select
Val() makes it a numeric test, too.
stanleydgromjr wrote:
>
> SteveM,
>
> The following code can be modified to suit your needs.
>
> Code:
> --------------------
>
>
> Sub ReturnExcelVersion()
> If Application.Version = "12.0" Then
> MsgBox "You are using Excel 2007."
> ElseIf Application.Version = "11.0" Then
> MsgBox "You are using Excel 2003."
> ElseIf Application.Version = "10.0" Then
> MsgBox "You are using Excel 2002."
> ElseIf Application.Version = "9.0" Then
> MsgBox "You are using Excel 2000."
> ElseIf Application.Version = "8.0" Then
> MsgBox "You are using Excel 97."
> ElseIf Application.Version = "7.0" Then
> MsgBox "You are using Excel 95."
> End If
> End Sub
>
>
> --------------------
>
> Have a great day,
> Stan
>
> --
> stanleydgromjr
> ------------------------------------------------------------------------
> stanleydgromjr's Profile: http://www.thecodecage.com/forumz/member.php?userid=503
> View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=126586
--
Dave Peterson