I need to import data from Excel to SQL Server using VBA
问题 I am trying to import data from another Excel workbook on my PC into SQL Server. I tried with this code, but it doesn't work: Sub insertion() Dim conn As ADODB.Connection Dim rs As ADODB.Recordset Dim sConnString As String Dim rsstring As String Dim m, nrows As Integer Dim loRH As Excel.ListObject Workbooks("test-vba.xls").Activate *connection* Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.Open sConnString MsgBox "Start" Set loRH = wkb.ListObjects(1) loRH.ListColumns(1)