Solved

VB opens wrong version of Excel

Posted on 2000-04-04
3
417 Views
Last Modified: 2011-08-18
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?
0
Comment
Question by:quantz
  • 2
3 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 2685797
Try this:
Set xlApp = CreateObject("Excel.Application.8")
0
 
LVL 1

Expert Comment

by:riduce
ID: 2686419
Make sure you mark the reference Microsoft Excel 8.0 Object Library
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2686916
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!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now