Microsoft KB Archive/135391

= XL5: Out of Stack Space Error Calling QueryGetData =

Article ID: 135391

Article Last Modified on 7/12/2001

-

APPLIES TO


 * Microsoft Excel 5.0c

-



This article was previously published under Q135391



*********************************************************************
 * - WARNING -                          **
 * THE INFORMATION BELOW IS PRELIMINARY AND HAS NOT BEEN      **
 * CONFIRMED, EDITED, OR TESTED BY MICROSOFT. USE ONLY        **
 * WITH DISCRETION.                                           **



SYMPTOMS
Microsoft Excel for Windows version 5.0c, may produce the following error message when calling a procedure that uses the xlquery.xla QueryGetData function:

Run-time error '28':

"Out of Stack Space"



CAUSE
Using the macro recorder, when you record clicking Get External Data on the Data menu in Microsoft Excel for Windows version 5.0c, selecting a data source in Microsoft Query, adding a table, performing a query and returning your data to Microsoft Excel, the recorded code you end up with is a series of application.run "QueryGetData" commands. This command is found in the xlquery.xla add-in file which ships with Microsoft Excel.

If you create a Sub procedure which calls this recorded macro using the application.run method and assign this sub procedure to a custom toolbar button or a button on your worksheet, you will receive the above error message when you click the button. You will also receive the error message if you attempt to run your Sub procedure by placing the pointer cursor on any line of the Sub procedure and clicking the built-in macro run toolbar button found on the Visual Basic toolbar.



RESOLUTION
To avoid the above error message do one of the following:

  Run your macro by clicking Macro on the Tools menu and selecting your Sub procedure from the listing of available macros and pressing Run.

-or-

 Place the pointer on any line of your calling procedure and press the F5 key. -or-

 Assign the Sub procedure to a custom menu option and run it from there.

Rather than using the QueryGetData command, use the SQLOpen, SQLExecQuery, SQLRetrieve, and SQLClose methods for retrieving data from your external data source.



STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
This behavior does not occur in Microsoft Excel version 5.0 for Windows or Microsoft Excel version 5.0 for Macintosh.

<div class="references_section">