Hi all
My client has modified their excel spreadsheets so the headers are now in row 5 instead of row 1. How can I modify the following function to reflect the changes?
Many thanks
My client has modified their excel spreadsheets so the headers are now in row 5 instead of row 1. How can I modify the following function to reflect the changes?
Code:
Public Function ImportHierarchyFunctionFiles()
Dim MyFile As String
Dim MyPath As String
Dim db As Database
Set db = CurrentDb ' Initialize db object
db.Execute "DELETE FROM tblFunction"
db.Execute "DELETE FROM tblLocation"
MyPath = "C:\KPMG\Hierarchy data\"
MyFile = Dir(MyPath & "*.xlsx")
Do While MyFile > vbNullString
DoCmd.TransferSpreadsheet acImport, 10, "tblFunction", MyPath & MyFile, True, "Function Hierarchy!"
DoCmd.TransferSpreadsheet acImport, 10, "tblLocation", MyPath & MyFile, True, "Location Hierarchy!"
MyFile = Dir
' MsgBox "Raw Data Imported for " & MyFile & " From " & MyPath
Loop
End Function
Many thanks