Results 1 to 6 of 6

import file problem

Threaded View

naaitie import file problem 10-30-2007, 07:16 AM
rylo Sven The file doesn't have... 10-30-2007, 07:11 PM
naaitie I have indeed noticed that it... 10-31-2007, 08:03 AM
mudraker Have you tried importing the... 10-31-2007, 08:23 AM
naaitie thanks! This thing does the... 10-31-2007, 12:23 PM
mudraker Not that I am aware of ... 10-31-2007, 04:42 PM
  1. #1
    Registered User
    Join Date
    01-06-2006
    Posts
    8

    import file problem

    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?
    Attached Files Attached Files
    Last edited by naaitie; 10-30-2007 at 09:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1