Link to home
Start Free TrialLog in
Avatar of quantz
quantz

asked on

VB opens wrong version of Excel

I am attempting to write a VB app which opens Excel spread sheets.

The code:

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open ("C:\temp\yadata.xls")

does sort of work.   The issue is that we have both version 5 and 97 on our PCs.  Version 5 is required by PeopleSoft (only) and everything else uses 97.
The issue is that  the code opens up version 5.0. All of the playing around that I've tried (such as trying to hard code paths) gives syntax errors.

How do I make it start up 97 not 5.0?
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of riduce
riduce

Make sure you mark the reference Microsoft Excel 8.0 Object Library
If xlApp is defined as Object, there is no need to reference Excel. I know this is not a good practice to declare as Object but it might help when dealing with multiple version!