Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excluding part of a file name when opening it

Status
Not open for further replies.

Demigorgon

Programmer
Dec 1, 2006
2
US
Hello tekies,

I am needing to open a file with a 3 part naming convention:

dateProcessed_dateCreated_timeStamp.txt
i.e. 092206_012307_0753.txt

I can get the first 2 dates fairly easily, but the timestamp will always be an unknown, so when opening the file I want to disclude that part : i.e.

Open "\C:092206_011207_" & "####" & ".txt" For Input As #1 -something to that effect.

Now, I know I can get the time stamp, but the goal is trying to concatinate 4 files into one, all with different timestamps. So the dates will be consistant, but the timestamps will never be the same, hence why I want to get rid of them when using it as a criteria.

Thanks!
 
You can loop thru all files in given directory and pick which ones you want to deal with.

For Open statement, you need to have the whole file name.

In VB6 you have something called FileListBox which you can populate with files in certain directory, and you can even apply a filter (patern) like "092206_011207_*.txt"

Check your VBA for something like that.



Have fun.

---- Andy
 
Have a look at the Dir function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Dir and all that is file processing, but I have to say I don't quite understand what it is you are asking.

To Open a file, any file, you have to use its name. So how can you Open a file, if you "disclude" part of its name? Using Dir (or FSO) you can loop through all files in a folder without seeing the name, but the system is still using the filename.

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top