+ Reply to Thread
Results 1 to 7 of 7

Copying files with FileCopy - files not released after running?

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Copying files with FileCopy - files not released after running?

    I've been using FileCopy to batch copy a list of files to a new location.

    While the procedure runs without any issues, after it finishes running, I try to cut the folder (to move it elsewhere) and I usually get an error message about files in use.

    Why does this happen? I am cutting the folder after the macro finishes - i.e. I'm not opening any of the copied files before I cut.

    Any ideas anyone?


    UPDATE: I am aware of FSO as an alternative for copying files. However I am asking this thread because I'm hoping someone can explain this behaviour (to improve my technical knowledge)
    Last edited by mc84excel; 07-14-2015 at 07:23 PM.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Copying files with FileCopy - files not released after running?

    Try this and see

    Please Login or Register  to view this content.
    Thanks

  3. #3
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Copying files with FileCopy - files not released after running?

    I think this may have more to do with how you try to cut the file with Explorer than with FileCopy. Make sure that the parent folder of the folder that you want to cut is selected in the treeview (left) pane. Now select the folder from the file (right) pane and cut. ie. This ensures that you're not 'in' the folder that you're trying to cut.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Copying files with FileCopy - files not released after running?

    Hi fredlo2010,

    I forgot to mention in the OP that I am already aware of FSO as a means of programatically copying files (I've used FSO in several projects). However I am curious to know why files cant be cut after using FileCopy - thus this thread.

    Your post does provide an alternative to anyone who stumbles on this thread looking for a quick fix so +1

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Copying files with FileCopy - files not released after running?

    Quote Originally Posted by cyiangou View Post
    I think this may have more to do with how you try to cut the file with Explorer than with FileCopy. Make sure that the parent folder of the folder that you want to cut is selected in the treeview (left) pane. Now select the folder from the file (right) pane and cut. ie. This ensures that you're not 'in' the folder that you're trying to cut.
    Thanks but I;m not cutting the file. I run the FileCopy to copy files to a new folder. When the sub finishes, I try to cut the entire folder and receive an error message.

  6. #6
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Copying files with FileCopy - files not released after running?

    I didn't mean to emphasize the 'cut' operation. Any file operation that would be affected by file locking applies. Oh shucks, nor did I mean to use the word 'file' instead of 'folder' in that first sentence.
    Last edited by cyiangou; 07-16-2015 at 11:10 AM.

  7. #7
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Copying files with FileCopy - files not released after running?

    Quote Originally Posted by mc84excel View Post
    Hi fredlo2010,

    I forgot to mention in the OP that I am already aware of FSO as a means of programatically copying files (I've used FSO in several projects). However I am curious to know why files cant be cut after using FileCopy - thus this thread.

    Your post does provide an alternative to anyone who stumbles on this thread looking for a quick fix so +1

    @ mc84excel

    Sorry for the late reply. I have been so busy.

    I am not sure what the problem is with the FileCopy sorry.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 2 files running(?) iso only 1
    By john55 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-31-2014, 12:20 PM
  2. Reg. running sub on multiple files
    By jonastjader in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2013, 05:42 PM
  3. Replies: 1
    Last Post: 11-12-2013, 03:44 PM
  4. Macro to Summarize daily files by copying blocks from daily files.
    By menoninblack in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2012, 07:26 AM
  5. Copy files via wildcard, FileCopy not working
    By koltregaskes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2011, 10:33 AM
  6. Alternative to the FileCopy Statement for open files?
    By broro183 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2008, 06:07 AM
  7. Running Macro on many files
    By Sean in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2005, 02:06 PM
  8. Running .exe files from Macro
    By devender_g in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2005, 07:30 AM

Tags for this Thread

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