first of all you have to add many components
-Ms ADO Data Control 6.0
-Ms Common Dialog 6.0
on A1, B1, C1, ... (Row Excel) fill with name of atributes on table as like as Access.
for example ID, Name
start the data that you what to save in A2, B2, ...
this is the code:
Dim db As ADODB.Connection
CommonDialog1.InitDir = ""
CommonDialog1.DialogTitle = "Select the Excel File to import from"
CommonDialog1.Filter = "Excel(*.xls)|*.xls"
If CommonDialog1.FileName <> "" Then
Set db = New ADODB.Connection`
db.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & App.Path & "\testA.mdb;Persist Security Info=False"
sqlstring = "INSERT INTO test SELECT * FROM [Excel 8.0;HDR=YES;Database=testE.xls].[Sheet1$]"
MsgBox "File not exists"
CommonDialog1.FileName = ""
MsgBox "Successfully Imported"
Set db = Nothing
testA is the name of database Access
testE is name of Excel file
test is table name.