I am new to the forum and appreciate any assistance. I have been developing VBA code for about 15 years mostly to automate Word forms to utilize information from databases. I am self taught and have little experience working with VBA in Excel. Now I am trying to create a VBA macro that will copy all .csv files from a primary source folder and, then, loop through all of its sub-folders to copy other .csv files to another target directory that will ultimately be used to import that data into a master workbook. The code is comprised of two subs: the first to copy .csv files from the primary source directory and, the second to copy all of the .csv files from each of the sub-directories. The first sub operates flawlessly and deposits files in the target directory but the code in the second sub does not seem to be able to identify the files in the sub-folders. The code appears to run without error and the message box at the end even tells me that the files have been copied but the files from the sub-directories are not deposited in the target folder. All of the files to be copied periodically have the same naming scheme e.g "SR0097.csv", "SR0098.csv". Microsoft Scripting Runtime is turned on. I am using Office 365 on a Windows 10 machine. I don't believe that this is a permissions or security issue because the first sub works on the primary source folder. I feel like my code needs a small tweak but I can't find it. Thanks in advance for any help you can provide. The code is as follows:
Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
Thank you.
Bookmarks