io di solito delego questi compiti nel senso che:
codice:
' procedura che copia
    Open App.Path & "\copia.bat" For Output As #iFile
        Print #iFile, "xcopy " & Filesorgente & " " & filedest
    Close #iFile
    
    ShellAndWait App.Path & "\copia.bat", vbHide
    
    Kill App.Path & "\copia.bat"
codice:
Private Declare Function OpenProcess Lib "kernel32" _
    (ByVal dwDesiredAccess As Long, _
    ByVal bInheritHandle As Long, _
    ByVal dwProcessId As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" _
    (ByVal hProcess As Long, lpExitCode As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" _
    (ByVal hObject As Long) As Long

Private Const STATUS_PENDING = &H103&

Public Sub ShellAndWait(sFile As String, Visualizzazione As Long)
Dim hProcess As Long
Dim ProcessId As Long
Dim CodExit As Long

    ProcessId = Shell(sFile, Visualizzazione)
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
    Do
        Call GetExitCodeProcess(hProcess, CodExit)
        DoEvents
    Loop While CodExit = STATUS_PENDING

    Call CloseHandle(hProcess)
End Sub