How to find the version of Excel in code

  • Thread starter Thread starter WayneM
  • Start date Start date
W

WayneM

I have a VB6 app that uses instantiates the Excel type
library, but they are different for Excel 97 and Excel
2K. How do I find which version is running so I know what
type library to use?

I have tried late binding by creating an object from the
Excel.Application object, but this doesn't seem to work
with different version of Excel.

Any other suggestions on how to do be able to have one app
run on different computers running different versions of
Excel would be greatly appreciated.

Thanks in advance,

WayneM
 
for my xp home, I get 10 when I use this.
MsgBox Left(Application.Version, 2)
so
if Left(Application.Version, 2)<10 then
or use a select case for several versions.
 
Hi WayneM,
I have tried late binding by creating an object from the
Excel.Application object, but this doesn't seem to work
with different version of Excel.

What specifically doesn't work? Late Binding should work well for the
situation you describe. Just make sure all Excel-related objects are
delcared As Object, and you need to use the actual values of Excel built-in
constants instead of the constant names.
 
Back
Top