ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to move files from the code (https://www.excelbanter.com/excel-programming/298524-how-move-files-code.html)

ana

How to move files from the code
 
Hi ,
does anyone know how to move all the file from one folder
to another from the code ?
For example : move *.* from C:\A to C:\B

thanks
ana

Don Guillett[_4_]

How to move files from the code
 
try
Sub movefile()
OldName = "C:\Al\yourfilename.xls"
NewName = "C:\B\yourfilename.xls"
Name OldName As NewName
End Sub
--
Don Guillett
SalesAid Software

"Ana" wrote in message
...
Hi ,
does anyone know how to move all the file from one folder
to another from the code ?
For example : move *.* from C:\A to C:\B

thanks
ana




Norman Jones

How to move files from the code
 
Hi Ana,

Try this routine posted by Dana deLouis:


Sub FilesMoveBetweenFolders()

Const FromFolder As String = "D:\Assets\*.*"
Const ToFolder As String = "D:\Closing\"

On Error Resume Next
With CreateObject("Scripting.FileSystemObject")
.CopyFile FromFolder, ToFolder, True
.DeleteFile FromFolder, True
End With

End Sub

---
Regards
Norman


"Ana" wrote in message
...
Hi ,
does anyone know how to move all the file from one folder
to another from the code ?
For example : move *.* from C:\A to C:\B

thanks
ana




Bob Phillips[_6_]

How to move files from the code
 
Hi Ana,

Try this

name "C:\MyDir" as "C:\NewDir"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ana" wrote in message
...
Hi ,
does anyone know how to move all the file from one folder
to another from the code ?
For example : move *.* from C:\A to C:\B

thanks
ana





All times are GMT +1. The time now is 12:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com