Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

connect sql databases

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Connect to SQL databases

Connect to SQL databases

ResolvedVersion 2010

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

Excel tip:

Quickly select a block of data

To quickly select a block of data make sure your active cell is somewhere whithin the block of data and then press Ctrl+* or Ctrl+Shift+8.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.12 secs.