stanigator
stanigator

Reputation: 10944

VBA: Delimiters for Input keyword

I'm trying to parse each line of a text file stored in filepath into my string array. However, it appears that I'm delimited by characters other than the newline character (for example, commas). Is there a way of parsing with new line characters exclusively? Thanks in advance for your guidance.

'Open filepath For Input As #1

    Do While Not EOF(1)
        Input #1, script(numlines)
        numlines = numlines + 1
        If numlines = maxlines Then
            maxlines = maxlines + 100
            ReDim script(maxlines)
        End If
    Loop

    ' Close file
    Close #1

Upvotes: 2

Views: 769

Answers (1)

bobbymcr
bobbymcr

Reputation: 24167

The Input # statement is generally used to read data written with the Write # statement. If you just want to read a line of text, you can use Line Input #.

Upvotes: 4

Related Questions