-
I have a small project that cuts a huge text file into smaller text files. It does so by searching the file, and at certain points, closing the file and starting a new filename to write to.
My problem: when i go to declare the filename to write to, I take a string from the file...
code:
Line input #1, lineb
filenamex = (Mid$(lineb, 66, 11)) + ".txt"
After it gets the string from (Mid$(lineb, 66, 11)), it puts a space before the .txt, so the filename ends up being something like "454k3464354 .txt" My program also writes the filenames to a HTML file, so that space makes things VERY difficult, as you can imagine :)
-
Line input #1, lineb
filenamex = (Mid$(lineb, 66, 11)) + ".txt"
change to
Line input #1, lineb
filenamex = Trim((Mid$(lineb, 66, 11))) + ".txt"
I don't know why you are having the problem, but this will solve it.
Line input #1, lineb
filenamex = (Mid$(lineb, 66, 10)) + ".txt"
Might solve it also, as you are probably getting the space from the file itself. In this case you are only taking 66 to 76 from the file, which seems to be all you are using.
-
Gotcha... Thanks a million