Hi everyone.
I'm very new to VBA programming, although I do have experience with programming in general.
I have been presented with a problem. A number of text files (4,500 of them in fact) exist within a directory that I need to access through VBA. Using Excel, I want to systematically open each file, one at a time, do some tests on specific cells (the txt file is tab formulated so the information of interest is always in one specific cell), then depending on whether or not the data in the cell was significant, I want to discard the file or save it to another predefined location. At the end, I should end up with a directory full of files that were of interest to me. This way, the PC does the boring work of going through the 4,500 files and I don't!
I'm not asking anyone to do the work for me here, but a pointer in the right direction would be good. I'm happy with doing the cell testing and saving the required files, but I'm not sure how to systematically open each and every one of the files in the directory one at a time. I know how to set a directory of interest within VBA and how to call the open file dialogue box to select files, but instead of this I just want to tell excel what my directory of interest is and let it open every single file, one at a time, and do some specific tasks that I have in mind on them each time. Until all the files in the directory have been done.
I found some info on the internet relating to this:
Dir$([<filepath>[,<attributes>]])
Which I thought may do what I want. I'll have a look into that tomorrow. In the meantime, if anyone here can point me in the direction of some interesting reading or volunteer some potential methods that could be of interest to me... then I'd very much appreciate it!
Cheers all,
Brian