Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

VBA: execute sql queries

Hello experts,

Please find bellow and attached a xlsm file that Use to update data in one of the database.

User generated image
I was wondering if there is a way to create a Sub in VBA in which I define the user information (username, password) server and database and directly run the various queries defined in Column B and if possible display the sql logs in msgbox or in an external file.

Thank you again for your help.
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Luis Diaz

ASKER

Thank you for this code.

Could you please let me know where should I report the server name and the database name?

Thank you again for your help.
Avatar of Rgonzo1971
Rgonzo1971

What type of db?
Sql  server db
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect it works, I will retest for other queries tomorrow.
Sorry for the delay. Tested and it works!