K
kkjensen
The Excel VBA helpfile has the following code for extracting a character
from the beginning of a textfile. If I change the parameters to
inputs(5,#1) it will extract the first 5 characters of the file.
Code:
--------------------
Dim MyChar
Open "TESTFILE" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
MyChar = Input(1, #1) ' Get one character.
Debug.Print MyChar ' Print to the Immediate window.
Loop
Close #1 ' Close file.
--------------------
I have a very big textfile and don't want to start my string from the
beginning. Is there a way to get the INPUT function (or another) to
read data out of the middle of a text file? Lets say I want just line
3.
Another problem: I would like to get just one line...how do I detect
the end of the line?
from the beginning of a textfile. If I change the parameters to
inputs(5,#1) it will extract the first 5 characters of the file.
Code:
--------------------
Dim MyChar
Open "TESTFILE" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
MyChar = Input(1, #1) ' Get one character.
Debug.Print MyChar ' Print to the Immediate window.
Loop
Close #1 ' Close file.
--------------------
I have a very big textfile and don't want to start my string from the
beginning. Is there a way to get the INPUT function (or another) to
read data out of the middle of a text file? Lets say I want just line
3.
Another problem: I would like to get just one line...how do I detect
the end of the line?