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
Friday, May 04, 2007
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.
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!