![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi everyone.
How do I check for a version at compile time? This first line produces a compile error... "Invalid use of object"
Thanks, Tom [ This Message was edited by: TsTom on 2002-05-15 15:10 ] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
I don't believe you can do this... You can make some 97, 2000, XP compatible code, but there are just some things that WON'T work in 97 !
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Thanks Juan
I found a constant which works: VBA6 Will return True if VBA6 or False if not. #If VBA6 Then 'compile code #End If However, this may give me problems with versions newer than 2000 if they do not use VBA 6.0. Do you know of any constants for the current version of Office? Besides Application.Version Thanks, Tom |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Quote:
This, from the inmediate pane: ?Application.VBE.Version 6.03 This is from Excel 2000. Well, as far as I can remember, Office XP is based on VB 6 too. |
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
Hi Tom,
Can you modify this to work for you? Function XL2KOrLater() If Val(Application.Version) >=9 Then XL2KOrLater = True Else XL2KOrLater = False End If End Function |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Thanks James...
That would work after the project is compiled. If I was dealing with runtime errors, then no problems with the Application.Version. I'm trying to work around a compile error in this case. I am hoping to find a constant which is available to determine which version of Office is running. I'm thinking API??? Just hoped to avoid the API. Thanks anyway friend, Tom |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|