The information in this article applies to:
SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article assumes that you are familiar with Visual Basic for Applications. CAUSE
Versions of Visual Basic for Applications in Microsoft Visual Basic 4.0 and
Microsoft Office 95 Professional only allowed optional arguments that were
of type Variant. Versions of Visual Basic for Applications in Microsoft
Visual Basic 5.0 and Microsoft Office 97 Professional now allow optional
arguments of non-Variant types.
RESOLUTIONThere are two possible resolutions to this behavior: Method 1When you use earlier version Automation client applications, do not rely on the newer type libraries for the Automation servers. Instead, reference the older version type libraries.For example, do not reference the Microsoft DAO 3.5 Object Library in Microsoft Visual Basic 4.0. Instead, reference the Microsoft DAO 3.0 Object Library. Similarly, if you are using Microsoft Access 7.0, create a reference to the Microsoft Excel 7.0 Object library and not the Microsoft Excel 8.0 Object library. Method 2Explicitly specify all arguments when you execute a method in the new type libraries. For example, when calling the Update method in the Microsoft DAO 3.5 Object Library, be sure to include values for its two arguments. The line of code will look similar to the following:
NOTE: The values dbUpdateRegular and False are the default values for the
Update method. By explicitly including them in the line of code, you will
not receive the "Argument not optional" error message.
For more information about the Update method, search the Help Index for "Update method." MORE INFORMATIONFollowing are examples of Microsoft Office 97 type libraries that may cause an error when referenced in earlier version Automation client applications:
Steps to Reproduce BehaviorThe following example demonstrates adding a new record to the Customers table in the Northwind sample database shipped with Microsoft Access 97, using the Microsoft DAO 3.5 Object Library.Although this example could be used from most earlier version Automation clients, this example specifically uses Microsoft Visual Basic 4.0 as an Automation client running code in the Microsoft DAO 3.5 Object Library.
REFERENCESFor more information about creating references to other applications, search the Help Index for "setting references, to applications." Additional query words: libraries Object TypeLib Dynamic Link Library DLL OLB TLB OLE Automation VB VBA 8.0 8.0a 97 Project VBA332.DLL VBA232.DLL
Keywords : |
Last Reviewed: November 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |