How can i copy every file in a folder to a new location that starts with 12345 please
Cheers
Gibbo
Printable View
How can i copy every file in a folder to a new location that starts with 12345 please
Cheers
Gibbo
[vba]Sub CopyEm()
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
'set your paths below
FSO.CopyFolder "C:\Windows\Desktop\New Folder", "C:\Windows\Desktop\12345"
Set FSO = Nothing
End Sub[/vba]
Gibbo
Do you mean every file that starts with 12345?
sorry norie, i did mean every spreadsheet that starts with 12345 in the same folder (e.g. C:\Test)
So 12345A.xls
12345B.xls and so on
Cheers gibbo
[VBA]
Sub CopyEm()
Dim oFSO As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
'set your paths below
oFSO.CopyFile "C:\MyTest\12345*.xls", "C:\NewDir\"
Set oFSO = Nothing
End Sub
[/VBA]
Hi Gibbo,
A minor adjustment to johnske's code to do this
[VBA]
Sub CopyEm()
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
'set your paths below
FSO.CopyFile "C:\Location\12345*.xls", "C:\NewLocation\"
Set FSO = Nothing
End Sub
[/VBA]
I ve been racking my brains for hours and its that simple :banghead:
thank you for putting me right
Gibbo