Run code based on version
not sure what you're looking for, but maybe something like this. when the
workbook opens, it sets the public variable. then the main sub runs whichever
sub based on the version.
in this workbook module:
Private Sub Workbook_Open()
eVersion = Application.Version
End Sub
in a general module:
Public eVersion As Long
Sub test1()
MsgBox "this runs if excel 2003"
End Sub
Sub test2()
MsgBox "this runs if excel 2007"
End Sub
Sub main_sub()
If eVersion = 11 Then
test1
ElseIf eVersion = 12 Then
test2
End If
End Sub
--
Gary
"Anthony" wrote in message
...
I am aware of the application.version function and I can also use the
conditional compile using the #if #else #endif statements.
What I need to do though is determine the version at run time and then run
different code depending. The conditional code needs a const which I cant set
at run time.
The various code is used to close of certain functionality of the workbook
etc... and this varies between versions.
Thanks in advance
Anthony
|