Alan Beban said:
Hi Harald,
I'm not following what you're saying. In my xl2000 (Version 9)
Application.Version = 9 returns True
Application.Version = 11 returns False
Application.Version < 11 returns True and
Application.Version > 11 returns False
What's the problem again with using these to test a Version number?
Hi Alan
Problem is that version is text, not number. Ran this macro in Excel2003 (v
11):
Sub test()
Dim Counter As Long
On Error GoTo errorprint
Counter = 1
If Application.Version > 9 Then _
Debug.Print Counter, Application.Version & _
" newer than 9"
Counter = Counter + 1
If Application.Version < 9 Then _
Debug.Print Counter, Application.Version & _
" older than 9"
Counter = Counter + 1
If Application.Version > "9" Then _
Debug.Print Counter, Application.Version & _
" newer than ""9"""
Counter = Counter + 1
If Application.Version < "9" Then _
Debug.Print Counter, Application.Version & _
" older than ""9"""
Counter = Counter + 1
If Val(Application.Version) > 9 Then _
Debug.Print Counter, Val(Application.Version) & _
" newer than 9"
Counter = Counter + 1
If Val(Application.Version) < 9 Then _
Debug.Print Counter, Val(Application.Version) & _
" older than 9"
Exit Sub
errorprint:
Debug.Print Counter, Err.Number & " " & Error
Resume Next
End Sub
and it printed this:
1 13 Type mismatch
1 11.0 newer than 9
2 13 Type mismatch
2 11.0 older than 9
4 11.0 older than "9"
5 11 newer than 9
Best wishes Harald