For the record, I am not a fan of Microsoft Excel. It’s not the application that annoys me so much as the way people use it. All too often, someone will write a quick and dirty script to pull data into Excel to solve a (supposedly) one-off issue. This spereadsheet is then copied and copied again until it becomes an unofficial part of some department’s workflow – undocumented and unsupported.
Then, years later and long after the original scripter has left, the data extract stops working and it falls to your local IT schmuck to figure out what is going on. And then the fun begins because it is not obvious where the query and database connection information are hidden.
After spending a bit of time with Google, I am now copying this information to here so that when I next need to check a query embedded in Excel, I can find the keystrokes a bit more quickly.
Cursor in the query results.
Alt+F11 to the VB editor
Ctrl+G to the immediate window
will give you the SQL of the query
will give you the connection details.