How to find the version of Excel in code

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
 
D

Don Guillett

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.
 
J

Jake Marx

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top