Microsoft KB Archive/136315

{|
 * width="100%"|

XL5: Run Time Error with QueryGetData or QueryGetDataDialog

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, version 5.0

-

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.