bill_reinwald
New Member
- Joined
- Sep 19, 2005
- Messages
- 22
I have a folder with various sub-folders in it, and I want to open up certain files within these sub-folders. I thought it would be easy enough to just add "\*" to the folder path, but VBA doesn't seem to like/understand this. Here's a snippet of code:
---------------
strPath = "\\CAISO-data\CAISO-Act4\LoadedFiles\" & "ISO " & pyear & dmonth & "\*"
strFile = Dir(strPath & "*.txt")
Do While strFile <> ""
.
.
.
------------------
But, it can't find any files using this and gives a bad name error when trying to assign to strFile. I know this code (without the last "\*") works fine as I use it all the time, shouldn't a sub-folder(s) be an easy addition?
thanks,
bill
---------------
strPath = "\\CAISO-data\CAISO-Act4\LoadedFiles\" & "ISO " & pyear & dmonth & "\*"
strFile = Dir(strPath & "*.txt")
Do While strFile <> ""
.
.
.
------------------
But, it can't find any files using this and gives a bad name error when trying to assign to strFile. I know this code (without the last "\*") works fine as I use it all the time, shouldn't a sub-folder(s) be an easy addition?
thanks,
bill