Running a query in the background allows you to use Microsoft Excel while the query runs.
- Click a cell in the external data range (external data range: A range of data that is brought into a worksheet but that originates outside of Excel, such as in a database or text file. In Excel, you can format the data or use it in calculations as you would any other data.), and then click Data Range Properties
on the External Data
toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, click Customize on the Tools menu, and then click the Toolbars tab.).
- Select the Enable background refresh check box to run the query in the background or clear it to run the query while you wait.
Notes
- Stop a query To stop a query from running when Enable background refresh is turned off, press ESC.
- Stop a background refresh To stop a query that is running in the background, double-click the Background Refresh
icon on the status bar (status bar: A horizontal bar at the bottom of the screen that displays information about the current condition of the program, such as the status of items in the window, the progress of the current task, or information about the selected item.) to display the External Data Refresh Status dialog box, and then click Stop Refresh.
- Recording a macro While you are recording a macro (macro: An action or a set of actions you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language.) that includes a query, Excel will not run the query in the background. To change the recorded macro so that it runs in the background, edit the macro in the Visual Basic Editor (Visual Basic Editor: An environment in which you write new and edit existing Visual Basic for Applications code and procedures. The Visual Basic Editor contains a complete debugging toolset for finding syntax, run-time, and logic problems in your code.) and change the refresh method for the QueryTable object from "BackgroundQuery := False" to "BackgroundQuery := True". For information about editing macros, see Visual Basic Help (Microsoft Visual Basic Help: To get help for Visual Basic in Excel, point to Macro on the Toolsmenu, and then click Visual Basic Editor. On the Help menu, click Microsoft Visual Basic Help.).