Move Files : Runtime Error 53 - File not Found - on xml files

sweeneytime

Board Regular
Joined
Aug 23, 2010
Messages
183
Hi,

I am getting a "Runtime Error 53 - File not Found" with the below code. I am trying to move xml files from one folder to another. The file exists as my other macro can access the xml files and extract the info. But i can't get the macro to move them! Any help would be much appreciated. Removing the last slash in the folder address hasn't worked either.

Cheers,
Sweeneytime
HTML:
Public Sub move()

        
        Dim MyFolder As String
        Dim NewFolder As String
        Dim MyFile As String
        
        
        MyFolder = "\\orcfinance\DynamicsGP\WebStore\FTP\Data\New\"
        NewFolder = "\\orcfinance\DynamicsGP\WebStore\FTP\Data\Archive\"
        MyFile = Dir(MyFolder & "\*.xml")
        Do While MyFile <> ""
            Name MyFolder & "\" & MyFile As NewFolder & "\" & MyFile
            MyFile = Dir
        Loop
        

End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
first loop through the directory to find all the files -- write the values to an array. Then loop through the array and move them :)
 
Upvote 0

Forum statistics

Threads
1,216,163
Messages
6,129,223
Members
449,495
Latest member
janzablox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top