Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB opens wrong version of Excel

Posted on 2000-04-04
3
Medium Priority
?
451 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 150 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 70

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

618 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