I was wondering how can I create a vba procedure in which I report the servername, user information, database name and Select SQL query and export the query to an specified Sheet.
The idea is to create a generic Procedure in which I include worksheet destination and SQL query as parameter.
This will alllows me to dynamically export the query based on the reported parameters,
Sub exportSQLQuery(Userinfo as String,pswd as String,DBname as String,DestinationWorksheet as Worksheet,SQLquery as ...)
The query should contains the headers of the table selected.
select * from MyTable
Thank you very much for your help.