The information in this article applies to:
SUMMARY
If an object is defined by the same name in more than one type library or
object library, and a reference to both of them is chosen, Visual Basic
uses the definition provided by the application listed higher in the
Available References Box of the References Dialog. MORE INFORMATIONWhat Is an Object Library?An Object Library is a file with an .OLB extension that provides information to OLE Automation controllers (like Visual Basic) about available OLE Automation objects. The Object Browser can be used to examine the contents of an object library to get information about the objects provided.What is a Type Library?A Type Library is a file or component within the object library that contains the OLE Automation standard descriptions of exposed objects, properties, and methods.How to Make Another Application's Objects Available to Your ApplicationAnother application's objects can be made available in your code by setting a reference to that application's object library. This can be done by choosing References from the Tools menu to bring up the References dialog box. Then you can select from a list of references displayed in the Available References box. To view these objects, choose Object Browser from the View menu.When you refer to an object in code, Visual Basic searches each application selected in the References dialog box in the order the applications are displayed. If two applications use the same name for an object, Visual Basic uses the definition provided by the application listed higher in the Available References box. What to Do If the Object You Want Lies Further Down in the ListIf the object you actually want is defined in an object library futher down in the reference list, you can:
-or- -or- -or- ExampleFor example, say you have the following code in an add-in:
The Property object is defined both in the DAO and the VBIDE object
libraries. If DAO appears ahead of VBIDE in the reference list, a "Type
Mismatch" error is generated at the For statement. This occurs because
VBIDE's Property object that is actually being used is shadowed by DAO's
Property object.Choose one of the following solutions as a remedy:
-or- -or- -or- Additional query words: 4.00 vb4win vb4all
Keywords : |
Last Reviewed: September 17, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |