Solved

VB6- Microsoft Excel 12.0 Object Library in the References

Posted on 2013-06-02
4
2,792 Views
Last Modified: 2013-06-02
Hello all

I would like to know if there is a way to auto select the good Microsoft Excel Object Library in the macro itself  when the project is opened instead of manually select it in the reference tab? That way, if i use different Microsoft office version, my project would always work.

Microsoft Excel 10.0 Object Library
Microsoft Excel 11.0 Object Library
Microsoft Excel 12.0 Object Library
Microsoft Excel 13.0 Object Library

Thanks again
0
Comment
Question by:Wilder1626
[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
  • 2
4 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 39214539
You can use late binding, which uses a CreateObject() function to instantiate your Excel object.  In many cases, you can use a generic form of the object in the string parameter, such as:
Set oXL = CreateObject("Excel.Application")

Open in new window

This will use the default application version on your system, which is most likely the most recent version installed.  However, you can supply version information in the CreateObject() parameter to force a particular version of Excel to be used.  My preference is to release production versions of code with late binding, since different versions will cause early binding (reference) failures in mixed-version environments.

What determines which version you might want to use?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 39214551
What determines which version i might use is that some of our PC are still not updated with Microsoft Office suite 2010. Some are still with Office 2007.

I was trying to see if i can have 1 compilation that would match both. But one thing is for sure, on the PC, there is only one of the version installed, 2007 or 2010
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 39214560
use the generic version of the string parameter.
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 39215073
Thanks again for your help
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
Protecting vb6 & .Net code Obfuscation 18 217
Excel Automation VBA 19 116
Modify Text File with Excel Macro 13 51
Word formfield existence 3 16
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

752 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