Copying Files/ Deleting Files / Moving Files
Sub Moving_Files()
Dim oFS As FileSystemObject
' Copying Files
FileCopy "c:\temp\IamAStar.xls", "c:\temp\backup\IamAStar.xls"
' Deleting Files
Kill "c:\temp\IamAStar.xls"
' Using File System Object - You need to Include Microsoft Scripting Runtime in you references
Set oFS = New FileSystemObject
' Moving Files
oFS.MoveFile "c:\temp\D8C7I12.xls", "c:\temp\backup\D8C7I12.xls"
End Sub
Thank you Shasur,
ReplyDeleteI've been looking for a concise example of how to move a file using VBA for about a week now and then I found your examples.
They were very easy to use and thank you for noting which references were required to run the code.
Legendary!