Hi,
I have a problem importing a file into Excel. Problem is that Excel doesn't recognize the new line character used in the file. The following code puts all data into one line, while I need to have them seperated. Working with the ResultStr results in an 'out of memory' exception. (I actually only need one particular line from my file.)
FileNum = FreeFile
Open "C:\Temp\LIJST.TXT" For Input As #FileNum
Do Until EOF(FileNum)
Line Input #FileNum, ResultStr
Loop
Close FileNum
The automatic way does work, but this will chop off the wanted line to 256 chars. (line 8, the one with all the '--')
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\Temp\LIJST.TXT", _
Destination:=Range("A1"))
.Name = "ANALYSE"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 4
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1)
' .TextFileFixedColumnWidths = Array(9, 9, 11, 6, 9, 302, 7)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Anyone knows the best way to fetch that line of code from the file?
thanks in advance,
Sven
*update*
apparently, the automatic way doesn't chop off other strings longer then 256 chars. It only does that with the '--'-line?
Bookmarks