Hello,
i use this code to import xls file in access
Sub ImportXLS()
' importeer xls bestand
Dim WrksheetName As String
Dim i As Integer
Dim xl As Object
Set xl = CreateObject("Excel.Application")
xl.Visible = True
xl.Workbooks.Open "C:\david\axor\01-mavo2409.xlsx"
With xl
.Visible = True
With .Workbooks(.Workbooks.Count)
For i = 1 To .Worksheets.Count
WrksheetName = .Worksheets(i).Name
DoCmd.TransferSpreadsheet (acImport), acSpreadsheetTypeExcel9, WrksheetName, "C:\david\axor\01-mavo2409.xlsx", True
Next i
End With
End With
Set xl = Nothing
End Sub
the WrksheetName is mavo2409, i want to create a vba code that add a record to an existing database _match where the new record has the value mavo2409.
i use this code to import xls file in access
Sub ImportXLS()
' importeer xls bestand
Dim WrksheetName As String
Dim i As Integer
Dim xl As Object
Set xl = CreateObject("Excel.Application")
xl.Visible = True
xl.Workbooks.Open "C:\david\axor\01-mavo2409.xlsx"
With xl
.Visible = True
With .Workbooks(.Workbooks.Count)
For i = 1 To .Worksheets.Count
WrksheetName = .Worksheets(i).Name
DoCmd.TransferSpreadsheet (acImport), acSpreadsheetTypeExcel9, WrksheetName, "C:\david\axor\01-mavo2409.xlsx", True
Next i
End With
End With
Set xl = Nothing
End Sub
the WrksheetName is mavo2409, i want to create a vba code that add a record to an existing database _match where the new record has the value mavo2409.