+ Reply to Thread
Results 1 to 6 of 6

Problem with code - move files to another directory

  1. #1
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Problem with code - move files to another directory

    Hi

    I have the following macro to move files from one folder to another,however I get an error if the file already exists. I have read many other snippets of code to resolve this, however I am still having problems

    Here is the code I currently have

    Please Login or Register  to view this content.
    Any help would be great
    Thanks

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Problem with code - move files to another directory

    This suffices
    Please Login or Register  to view this content.



  3. #3
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Re: Problem with code - move files to another directory

    hi there,

    thanks for the reply however i am not what the above code does. i only want to move all files from one folder to another, not the entire folder. the folder always needs to remain in the original location (only the individual excel files should be moved)

    Thanks again

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Problem with code - move files to another directory

    Can you explain to me what is the difference between moving all files in a folder and moving the folder ?
    Do you know the difference between copying and moving ?

  5. #5
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Re: Problem with code - move files to another directory

    Hi,

    I need the files to be moved as another macro picks up files from the original location. If they are not moved then they would be picked up again, which I do not want. That is why I want to move them to another location rather than copy.

    I want to move all files from:

    F:\OLDFOLDER

    to

    F:\NEWFOLDER

    The code I provided above does work in the first instance, however it does NOT work if the file already exists in the new folder location. If this is the case then I would like to overwrite the file however I cannot figure out how to do this.

    I am not sure how to work that into the code you provided.

    Thanks again

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Problem with code - move files to another directory

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1