Select specific text in cell
In thinking a little more about this question, it would appear, given the
structure the OP has adopted, that **at least one** of the following must
be
true or the OP cannot have a fool-proof parser... the filename can never
have a dash, or it can never have a space/dash/space combination in it, or
it can never have just a plain space in it (which would further require a
space always be present after the filename), or the description cannot
have
a backslash in it... one of these must be true in order to create a parser
(one-liner or not) that would always work.
Expanding -- it would certainly be possible for a parser in which the "\"
preceding the filename was optional
Which is, of course, a possibility; though, in today's type file
referencing, somewhat rare. If the default path is at the directory where
the file is located, then you can legally specify the file using something
like this... c:filename.ext and the operating system will look in the
current directory. On my system, there is a directory called TEMP at the
root level of my C: drive. In that directory is a file named Test.txt. The
following code (showing a 'backslashless' path reference) prints the first
line of the file into the Immediate window...
Sub test()
ChDir "c:\temp"
Open "c:test.txt" For Input As #1
Line Input #1, LineOfText
Close #1
Debug.Print LineOfText
End Sub
Rick
|