+ Reply to Thread
Results 1 to 4 of 4

Do macro wait until the paste process of the copied file finish then continue ?

  1. #1
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Do macro wait until the paste process of the copied file finish then continue ?

    I don't know what's wrong with my computer,
    but I've found out that copying file from my internal HDD to USB 3.0 drive manually :
    - if I select multiple files in the source folder, ctrl+c, then ctrl+v to another folder, the transfer rate drop to between 25-40 MB/s
    - if I do it one by one, wait until the paste process finish, then copy another one, paste then wait until finish, the transfer rate is almost constant per paste between 70 - 100 MB/s.

    All the files to be copied is video mkv files where per file size vary from 6 to 20 gb.

    So I've been thinking to automate via vba that "manually copy-paste file one by one and wait until the previous paste process finish".
    But I don't know how to code "the waiting" process.

    So far I've tried like this :
    Please Login or Register  to view this content.
    From the code above, when I F8, it seems the macro halt by the time it want to pass the green code above,
    as the yellow highlight didn't directly hit the "end if". So it seems it did wait until the paste process finish ?
    After I saw the "end if" has the yellow highlight (then I check the file in the destination folder is correct), then I can continue the F8.
    But to be honest, I'm not sure about that, so I ask here.

    Any kind of respond would be greatly appreciated.
    Thank you in advanced.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Do macro wait until the paste process of the copied file finish then continue ?

    I believe it does wait, to answer your title's question. But unless there's anything else to do with Excel, you may want to consider using batch script or powershell for this copying process instead.
    多么想要告诉你 我好喜欢你

  3. #3
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Do macro wait until the paste process of the copied file finish then continue ?

    Hi millz,

    Thank you for your help.
    After I read your respond, I run the code (not step run) and
    Yesss... it did wait until the previous paste process finish, then the macro go on to the next loop.

    To be honest, I don't know how to write a batch script / powershell / cmd.
    Anyway, thank you once again for your help.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Do macro wait until the paste process of the copied file finish then continue ?

    Quote Originally Posted by karmapala View Post
    To be honest, I don't know how to write a batch script / powershell / cmd.
    Just take a few minutes to learn it, I am sure you can manage it in less than 10 minutes.

    A one-liner robocopy can do what you did here with VBA. Plus, you don't have to launch Excel for that.

    https://ss64.com/nt/robocopy.html

+ 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. [SOLVED] Message Box: Continue with Macro or cancel process
    By Student1990 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2013, 03:03 PM
  2. [SOLVED] Pop Up Box - Wait for Range input - Continue Macro
    By The Skipper in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-14-2013, 04:41 PM
  3. Make macro wait for process to complete
    By pjaj in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-13-2012, 01:05 AM
  4. How To Wait 2 Seconds After Msgbox & Then Continue
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2010, 12:16 PM
  5. Make macro wait for process to complete
    By shawnh in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 02-16-2010, 07:52 PM
  6. Wait for Text Import to Finish before Sorting
    By tomlancaster in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-28-2009, 08:56 AM
  7. How to force a macro to wait for a large sheet sort to finish
    By nicohlis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2005, 11:15 AM

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