954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Moving a file location

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.

Nelly1965
Newbie Poster
12 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

Use the filesystemobject. This page is for ASP, but it's basically the same

http://www.w3schools.com/asp/asp_ref_filesystem.asp

davidcairns
Junior Poster
114 posts since Feb 2007
Reputation Points: 12
Solved Threads: 8
 

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

shasur
Newbie Poster
20 posts since Aug 2006
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You