

With Excel VBA you can automate tasks in Excel by writing so called macros.

(,) Values ('speedy shipping','(503) 555-1234')")Ĭall ExecuteCmd("SELECT * FROM. VBA (Visual Basic for Applications) is the programming language of Excel and other Office programs. Read data from record set Private Sub ReadRS()ĭebug.Print "ShipperID: " & mRS.Fields("ShipperID").Value & " CompanyName: " & mRS.Fields("CompanyName").Value & " Phone: " & mRS.Fields("Phone").ValueĬlose connection Private Sub CloseConnection()Ĭall OpenConnection("ServerName", "NORTHWND")Ĭall ExecuteCmd("INSERT INTO. with SQL Server Authentication Private Sub OpenConnection2(pServer As String, pCatalog As String, pUser As String, pPsw As String)Ĭall mDataBase.Open("Provider=SQLOLEDB Initial Catalog=" & pCatalog & " Data Source=" & pServer & " Integrated Security=SSPI User ID=" & pUser & " Password=" & pPsw)Įxecute sql command Private Sub ExecuteCmd(sql As String) with Windows Authentication Private Sub OpenConnection(pServer As String, pCatalog As String)Ĭall mDataBase.Open("Provider=SQLOLEDB Initial Catalog=" & pCatalog & " Data Source=" & pServer & " Integrated Security=SSPI")ī. Microsoft ActiveX Data Objects Recordset 2.8 Libraryĭeclare variables Private mDataBase As New ADODB.ConnectionĬreate connection a. Microsoft ActiveX Data Objects 2.8 Library

I will extract data from an External Excel file called MOCK this file I have a list of Male/Female mock-up customers.
