-
Try:
[vba]
Option Explicit
Sub exa()
Dim FSO As Object
Dim rCell As Range
Dim rngFileNames As Range
'// Change paths and extension to suit. //
Const FOL_FROM As String = "D:\110609M\123109\Ch2_Lv1\"
Const FOL_TO As String = "D:\110609M\123109\Ch1_Lv1\"
Const EXT As String = ".txt"
'// Change range to suit //
Set rngFileNames = Selection
Set FSO = CreateObject("Scripting.FileSystemObject")
For Each rCell In rngFileNames
'// Ensure that source file exists and that its not //
'// already copied. //
If FSO.FileExists(FOL_FROM & rCell.Value & EXT) _
And Not FSO.FileExists(FOL_TO & rCell.Value & EXT) Then
FSO.CopyFile FOL_FROM & rCell.Value & EXT, FOL_TO, False
End If
Next
End Sub
[/vba]
Hope that helps,
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules