Hey there,
I have a problem,
I'm pretty much new to access and VBA.
For my girlfriend i'm trying to figure out a problem but i'm not getting it fixed.
For a conference she will get back forms in excel from attending people.
In the Excel workbooks, on Sheet4, there is data which i would like to import into access. The first row contains the column headings from the access table that i would like to import all the sheets in.
Is there a way that i could make an automated action that imports Sheet4 from all the .xls file in a specified folder into my access table???
I found this code on this forum but it doesn't seems to work here.:
Sub Command14_Click()
Dim myFolder As String, fileLoop As Integer
myFolder = "C:\my documents\excel"
With Application.FileSearch
.LookIn = myFolder
.FileName = "*.xls"
.Execute
If .foundfiles.Count > 0 Then
For fileLoop = 1 To .foundfiles.Count
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tbl_import", .foundfiles(fileLoop)
Next fileLoop
End If
End With
End Sub
I would greatly appreciate any help on this topic.
Also it would be nice, shoot me if i ask too much, if all the imported files would be automatically transported to a different folder.
Thanks again,
Rutger
I have a problem,
I'm pretty much new to access and VBA.
For my girlfriend i'm trying to figure out a problem but i'm not getting it fixed.
For a conference she will get back forms in excel from attending people.
In the Excel workbooks, on Sheet4, there is data which i would like to import into access. The first row contains the column headings from the access table that i would like to import all the sheets in.
Is there a way that i could make an automated action that imports Sheet4 from all the .xls file in a specified folder into my access table???
I found this code on this forum but it doesn't seems to work here.:
Sub Command14_Click()
Dim myFolder As String, fileLoop As Integer
myFolder = "C:\my documents\excel"
With Application.FileSearch
.LookIn = myFolder
.FileName = "*.xls"
.Execute
If .foundfiles.Count > 0 Then
For fileLoop = 1 To .foundfiles.Count
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tbl_import", .foundfiles(fileLoop)
Next fileLoop
End If
End With
End Sub
I would greatly appreciate any help on this topic.
Also it would be nice, shoot me if i ask too much, if all the imported files would be automatically transported to a different folder.
Thanks again,
Rutger