I have code which imports many text documents, containing foreign/special characters, into an Excel workbook:
Sub loadfiles()
Dim fpath As String
Dim fname As String
Application.ScreenUpdating = False
fpath = "...\data\"
fname = Dir(fpath & "*.txt")
For i = 1 To 10
Application.StatusBar = True
Application.StatusBar = "Progress: " & i & " of 10000"
Sheet1.Select
Range("A" & i).Value = fname
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" _
& fpath & fname, Destination:=Range("B" & i))
.Name = "a"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileColumnDataTypes = _
Array(xlTextFormat, xlSkipColumn, xlGeneralFormat)
.Refresh BackgroundQuery:=False
fname = Dir
End With
Next i
Application.StatusBar = False
Application.ScreenUpdating = True
MsgBox "Done"
End Sub
Is there any way to import text without losing original characters?