I am processing word documents and would like to move the files to a new location after processing. What code do I use to move file from one directory to another.

Sub Moving_Files()
Dim oFS As FileSystemObject
' Easiest way
FileCopy "c:\temp\IamAStar.xls", "c:\temp\backup\IamAStar.xls"
Kill "c:\temp\IamAStar.xls"
' Using File System Object - You need to Include Microsoft Scripting Runtime in you references
Set oFS = New FileSystemObject
oFS.MoveFile "c:\temp\D8C7I12.xls", "c:\temp\backup\D8C7I12.xls"


End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.