Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to copy periodically all files (without any other data
manipulation) from folders W, X, Y on Drive C to folder Z on Drive D. Any existing files would ge ovewritten without prompting. Is it more convenient to process this through Windows Task Scheduler or through VBA ? Help appreciated, J.P. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you need to work only with files, not subfolders, you can use code
like the following: Sub AAA() Dim FromFolders As Variant Dim ToFolder As String Dim N As Long Dim FName As String FromFolders = Array("C:\Test", "C:\Test2") ToFolder = "D:\Z" Application.DisplayAlerts = False For N = LBound(FromFolders) To UBound(FromFolders) ChDrive FromFolders(N) ChDir FromFolders(N) FName = Dir("*.*", vbNormal) Do Until FName = vbNullString On Error Resume Next Kill ToFolder & "\" & FName On Error GoTo 0 Name FName As ToFolder & "\" & FName FName = Dir() Loop Next N End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Fri, 5 Mar 2010 13:52:56 -0800 (PST), u473 wrote: I need to copy periodically all files (without any other data manipulation) from folders W, X, Y on Drive C to folder Z on Drive D. Any existing files would ge ovewritten without prompting. Is it more convenient to process this through Windows Task Scheduler or through VBA ? Help appreciated, J.P. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
task scheduler | New Users to Excel | |||
Task Scheduler | Excel Programming | |||
Task Scheduler | Excel Programming | |||
Task Scheduler | Excel Programming | |||
Task Scheduler | Excel Programming |