I would like to iterate through folders. I'm attempting to do so using the dir function. Here is the code I tried:
FolderName = Dir(PathName, vbDirectory)
Do While FolderName <> ""
MsgBox("FolderName = " & FolderName)
'Other code will eventually go here
FolderName = Dir()
Loop
I can't understand why the first two FolderName strings that are displayed with MsbBox are "." and ".." (one period and then two periods) before it even gets to the first folder name.
Also, it not only returns the desired folder names but also the names of the Excel workbooks that are in the same main folder. How do I get the dir function to only return folder names?
Bookmarks