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