Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy files in sub folders to a specific directory
Dear experts:
I got more than 50 subfolders located under the following main folder's path: C:\test\MainFolder\... ....SubFolder_1 ....SubFolder_2 ....SubFolder_3 ....SubFolder_4 ....SubFolder_n There is (1) one xlsx-file in every subfolder. I now would like to be able via a Macro to copy the xlsx-files located in the sub folders directly into the following directory: C:\test\MainFolder. Is this feasible? Help is much appreciated. Thank you very much in advance. Regards, Andreas |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy files in sub folders to a specific directory
You can use the Name function, from help
Name oldpathname As newpathname something like this, untested! s1 = C:\test\MainFolder\SubFolder_#\myFile.xls" s2 = C:\test\MainFolder\myFile" for i = 1 to 50 sOld = replace(s1, "#", cStr(i)) sNew = s2 & "myFile_" & right("0" & i, 2) & ".xls" Name sOld as sNew Next Regards, Peter T "andreashermle" wrote in message ... Dear experts: I got more than 50 subfolders located under the following main folder's path: C:\test\MainFolder\... ...SubFolder_1 ...SubFolder_2 ...SubFolder_3 ...SubFolder_4 ...SubFolder_n There is (1) one xlsx-file in every subfolder. I now would like to be able via a Macro to copy the xlsx-files located in the sub folders directly into the following directory: C:\test\MainFolder. Is this feasible? Help is much appreciated. Thank you very much in advance. Regards, Andreas |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help to copy files names in a column from one directory to another directory VBA | Excel Programming | |||
Using VBScript to list all folders in a directory and files ... | Excel Programming | |||
Opening all files located in a specific directory | Excel Programming | |||
Reading files on a specific folders | Excel Programming | |||
Open files from specific directory | Excel Programming |