ashwinghanta
Board Regular
- Joined
- Dec 6, 2011
- Messages
- 118
<tbody>
[TD="class: votecell"]
[TD="class: postcell"]I am trying to import CSV files located in a folder into Access as new tables and I have been trying with a code
[/TD]
</tbody>
<tbody>
[TD="class: votecell"]
[TD="class: postcell"]I am trying to import CSV files located in a folder into Access as new tables and I have been trying with a code
Code:
Public Const rootdir = "C:\Users\deb670s\Desktop\importcsv"
Sub import()
Dim nr As Integer
Dim file As AcBrowseToObjectType
file = Dir$(rootdir & "*.csv")
nr = 1
Do While file <> ""
DoCmd.TransferText acImportDelim, "ImportSpec", "NewTableName-" & nr, rootdir & file, True, msoEncodingCentralEuropean
file = Dir$
nr = nr + 1
Loop
End Sub
But I get an error saying variable not defined at msoEncodingCentralEuropean Can someone tell me where am I going wrong?
[/TD]
</tbody>
Last edited: