I am Using VBA and Iam trying to import the table from Excel

I am Using VBA and Iam trying to import the table from Excel to Access this code is not working can you help me with it please aand make it work!!!

Sub AddData()

Dim cn As ADODB.Connection
Dim Sheet1 As String

Set cn = New ADODB.Connection

cn.Open \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Project1_Faris.xlsm;Extended Properties=Excel 8.0;\" _
& \"Persist Security Info=False\"

\' Append data from Sheet1 of workbook to Table1 of mydb.mdb:
cn.Execute \"INSERT INTO Table1([Thrillseekers]) IN \'C:\\Users\\Danny\\Desktop\\Project_1\\Database11.mdb\' SELECT mytable1.Thrillseekers FROM myTable1\"

cn.Close
Set cn = Nothing

End Sub

Solution

              strFile = Dir()

Loop

End Functon

I am Using VBA and Iam trying to import the table from Excel to Access this code is not working can you help me with it please aand make it work!!! Sub AddData(

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site