Hi
I need to import over 20 excel files into one table in a new project.
I have found the following code to do this:
	
	
	
		
The code is producing a "wend without while error".
Could someone please have a look at this and let me know what is wrong.
Many thanks
 I need to import over 20 excel files into one table in a new project.
I have found the following code to do this:
		Code:
	
	
	Public Function Impo_allExcel()
Dim myfile
Dim mypath
mypath = "C:\KPMG\Country_Data"
ChDir (mypath)
myfile = Dir()
Do While myfile <> ""
  If myfile Like "*.xlsx" Then
     'this will import ALL the excel files
     '(one at a time, but automatically) in this folder.
     ' Make sure that's what you want.
    DoCmd.TransferSpreadsheet acImport, 8, "tblConsolRawData", mypath & myfile
  End If
  myfile = Dir()
Wend
End Function
	The code is producing a "wend without while error".
Could someone please have a look at this and let me know what is wrong.
Many thanks