XL5: Run Time Error with QueryGetData or QueryGetDataDialog

ID: Q136315

5.00 WINDOWS kbtool

The information in this article applies to:

SYMPTOMS

In Microsoft Excel, you may receive the following error message if you run a macro that uses either the QueryGetData or the QueryGetDataDialog in Microsoft Excel version 5.0:

   Run-time error '1003'
   "Invalid Number of Arguments"

These XLQUERY.XLA add-in functions

CAUSE

In Microsoft Excel 5.0, there was not an option to save your password with a query when using "Get External Data" from the Data menu. This feature was added in Microsoft Excel version 5.0c. Likewise, in Microsoft Excel version 5.0c, the XLQUERY.XLA add-in functions QueryGetData and QueryGetDataDialog acquired an additional argument called "KeepPassword" to determine whether or not the password should be saved with the query in your workbook.

MORE INFORMATION

The syntax for these functions in Microsoft Excel versions 5.0 is:

   QueryGetData(ConnectionStr, QueryText, KeepQueryDef, FieldNames,
       RowNumbers, Destination, Execute)

   QueryGetDataDialog(ConnectionStr, QueryText, KeepQueryDef, FieldNames,
       RowNumbers, Destination, Execute)

The syntax for these functions in Microsoft Excel version 5.0c is:

   QueryGetData(ConnectionStr, QueryText, KeepQueryDef, FieldNames,
       RowNumbers, Destination, Execute, KeepPassword)

   QueryGetDataDialog(ConnectionStr, QueryText, KeepQueryDef, FieldNames,
       RowNumbers, Destination, Execute, KeepPassword)

If you run a macro that uses the eighth argument ("KeepPassword") in Microsoft Excel 5.0 (not the "c" release), you may receive the error message "Invalid Number of Arguments" when the macro is run. You will not receive this error in Microsoft Excel 5.0c.

REFERENCES

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q118754
   TITLE     : XL5: No Option to Save/Not Save Password with MSQuery Add-in

KBCategory: kbtool KBSubcategory:

Additional reference words: 5.00c addin

Version           : 5.00
Platform          : WINDOWS

Last Reviewed: September 14, 1996