Connect to SQL Database using Excel VBA
Excel macro, written in VBA connects to SQL database using a query from GetSQLString function and copies the recordset into Sheet1("A1"). Error handling is included.
- Excel with VBA enabled
- Enabled developer tab in Excel (options -> customize Ribbon, check Developer)
- Under Tools/References add a reference for Microsoft Activex Data Objects Library.
- Import .bas file from the commit into a new module or use the Excel which already has the module included.