Thread: FileCopy
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter_A_M (NL) Peter_A_M (NL) is offline
external usenet poster
 
Posts: 12
Default FileCopy (now OK!)

So sorry!

Almost always thoroughly testing, but not this time...
so at least two mistakes!

Here the correct code

PathFrom = "c:\Temp1" ' both paths should exist
PathTo = "c:\Temp2"

varTest = Dir(PathFrom + "\*.*") ' filename [wildcards allowed] necessary

Do Until varTest = ""
FileFrom = PathFrom + "\" + varTest
FileTo = PathTo + "\" + varTest ' now a better variable name!
FileCopy FileFrom, FileTo
varTest = Dir
Loop


Greetings again,
Peter