• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Wait Until Folder Is Finished Copying?

How do you add a wait until file finishes being copied script?


Set Fobj = CreateObject("Scripting.FileSystemObject")

Fobj.CopyFolder ThisWorkbook.Path & "Example.txt", _

ThisWorkbook.Path & "Copied2Example.txt"


Just trying to figure out a way to loop a wait until it finishes copying (I'm actually moving large folders).
 
I frankensteined some things around I found online.

It's working.


I hope this helps someone.


Sub Check_Compied_Completion()

Application.ScreenUpdating = False

'''''''''''''''''''''''''''''''''''''''''''''''''

Dim FIRSTFILECOPIEDCHECK01 As String

Dim FIRSTFILECOPIEDCHECK02 As String

Dim LASTFILECOPIEDCHECK01 As String

Dim LASTFILECOPIEDCHECK02 As String

'''''''''''''''''''''''''''''''''''''''''''''''''

FIRSTFILECOPIEDCHECK01 = "C:UsersAnonymousDesktopFolder1file01.txt"

FIRSTFILECOPIEDCHECK02 = "C:UsersAnonymousDesktopFolder1Folder2file02.txt"

LASTFILECOPIEDCHECK01 = "C:UsersAnonymousDesktopFolder1Folder2Folder3file03.txt"

LASTFILECOPIEDCHECK02 = "C:UsersAnonymousDesktopFolder1Folder2Folder3Folder4file04.txt"

'''''''''''''''''''''''''''''''''''''''''''''''''

Dim Fobj As Object

Set Fobj = CreateObject("Scripting.FileSystemObject")

'''''''''''''''''''''''''''''''''''''''''''''''''

Do While Fobj.fileexists(FIRSTFILECOPIEDCHECK01) = False

Loop

If Fobj.fileexists(FIRSTFILECOPIEDCHECK01) = True Then

MsgBox "Check 01 First File Copied Complete"

End If

'''''''''''''''''''''''''''''''''''''''''''''''''

Do While Fobj.fileexists(FIRSTFILECOPIEDCHECK02) = False

Loop

If Fobj.fileexists(FIRSTFILECOPIEDCHECK02) = True Then

MsgBox "Check 02 First File Copied Complete"

End If

'''''''''''''''''''''''''''''''''''''''''''''''''

Do While Fobj.fileexists(LASTFILECOPIEDCHECK01) = False

Loop

If Fobj.fileexists(LASTFILECOPIEDCHECK01) = True Then

MsgBox "Check 03 First File Copied Complete"

End If

'''''''''''''''''''''''''''''''''''''''''''''''''

Do While Fobj.fileexists(LASTFILECOPIEDCHECK02) = False

Loop

If Fobj.fileexists(LASTFILECOPIEDCHECK02) = True Then

MsgBox "Check 04 First File Copied Complete"

End If

'''''''''''''''''''''''''''''''''''''''''''''''''

Application.ScreenUpdating = True

End Sub
 
Back
Top