Querying External Data in Excel

What is External Data
Create a query in the UI
The External Data Toolbar
Edit a query in the UI
Create a query with VBA
Delete a query with VBA
Change the SQL with VBA
Change the database location
Parameters

The External Data Toolbar

This is what it looks like:

Buttons:

Edit Query - This button allows you to edit the query in the same fashion in which you created it.  That is, if you used the Wizard when you created it, this allows you to re-run the Wizard.  If you didn't use the Wizard, MSQuery opens and loads your query.  For more information on the Wizard, see Create a Query in the UI

Note that in certain cases you can create a query using the Wizard, that later will not be editable in the Wizard.  For example, if you create more than one criteria using the same field, MSQuery will interpret the syntax differently in its UI than it does for the Wizard.

Data Range Properties - shows the Data Range Properties dialog.

Unchecking "Save query definition" will not the delete the data that's on the sheet, but it will prevent you from Refreshing the data or making any other changes to the underlying query (because it's gone for good).  The rest of the options are pretty harmless and you can experiment with them at will.

Query Parameters - Shows the Query Parameters dialog and allows you to change existing parameters.  It doesn't, however, let you add a parameter if none exists.  That's why it appears disabled above.  For more information on parameters see the Parameters page.

Refresh - The last four buttons all deal with refreshing.  The Refresh button refreshes only the currently selected query.  Cancel Refresh cancels any refreshes that are in progress.  Refresh All refreshes every query in the active workbook.  Refresh Status shows you the progress of the refresh.

Edit a Query in the UI

To edit a query, click the first button on the External Data Toolbar.  This will lead you to the External Data Wizard or MSQuery, depending on how you created the query.  For more information on the Wizards, see Create a Query in the UI.

 Home                

 

                    Contact Me            Visit Daily Dose of Excel - an Excel weblog