This small Excel macro allows you to execute SQL commands on any ODBC data source directly in Excel and will paste the results in an Excel sheet where you can sort, filter and further manipulate the data. Useful to quickly extract data from a database and manipulate it within excel. No need to copy and paste large sets of data from other programs to gain the full functionality of Excel.

Some ODBC databases do not have convenient SQL query tools. For example, I work with Transact ODBC (U/SQL) every day and their query tool does not allow you to copy results and paste it into Excel. I often need to extract some data for a client and email it to them in Excel. In the past I used to change a generic PHP page to give me the results in an HTML table, which I could copy into Excel. This works, until you need to extract a couple of hundred or thousand rows, in which case it takes a couple of minutes just to copy the HTML table into memory. With this macro, the results are immediately available in Excel.
There's nothing fancy about this macro and it will only be useful to people who are comfortable with SQL and probably have the skills to develop something like this themselves. This is why I am giving it away for free and why the source code is available to you to alter as you wish. My experience though, is that if I find something useful, there will be other people who'd also find it useful in their own day-to-day lives. Have a look at it. If you can use it, go ahead - otherwise, nothing lost.
Version 2
With Version 2 the macro will split the results into seperate workbooks based on the "Break On Column". Click on a table name, then double-click on one of the column names to place that column into the "Break On Column" box.
Be Careful! The macro will create a new Excel Workbook for every distinct value in the "Break On Column". Each workbook will remain open until the query is complete, so the macro may use a considerable amount of your PC's resources.
Download now
|