How to open MSQuery in a macro in Excel, creating a query
and return the result in a worksheet.
Not exactly sure how to do that from scratch but my way of doing it would be to go to Tools/Macro/Record a new macro, then go to Data/GetExternalData/NewDatabaseQuery and create a Query to pull in your data from wherever. Then go into your Tools/Macro/VisualBasicEditor when done and in the VBE editor see the code for the macro. But like I stated, that's the way I would do it and have done it, but may not be the best. Mainly use Access so not all that keen on Excel. Hopefully someone will help you out with more expertise.
Thanks for your response, but the problem is, that the macro recorder doesn't record the steps between opening MSQuery and showing the results.
The result exists only out of the QueryTables.Add command(s).