Adrian has attended:
Excel VBA Introduction course
Connect to SQL databases
Hello,
I want to create a macro that call's a SQL database or stored procedure in a SQL database to copy in the information when I open the excel sheet, define a variable (for the query/stored procedure) and click a button to inititae the macro.
How do you call a stored procedure or run a query on a SQL database?
Thanks!
RE: Connect to SQL databases
Hi Adrian,
Thank you for the forum question.
And thank you for the nice feedback.
The best way as I told you is to use ADO to create a connection via a provider. You can connect to a query already created in the SQL database or you can write a SQL query in the visual basic editor and then execute the query from Excel.
SQL is very powerful and you are totally in control using SQL to tell Excel which data you want to display in your Excel reports.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector