ciao iff,
controlla le autorizzazione delle cartella di destino, credo che tu non hai la facoltà di scrivere all'interno di essa.
per il taglia incolla del file, prova, se vuoi, questa soluzione senza l'uso di FSO, personalizzando i percorsi di origine/destino.
Ho tralasciato l'action query del tuo codice.
Private Sub cmdMove_Click()
On Error GoTo errHandler
If Len(Me.cboClienti & vbNullString) = 0 Then
VBA.MsgBox "non hai selezionato nulla", vbInformation
Exit Sub
End If
Dim strPath As String
Dim strSourceFile As String
Dim strDestPath As String
strPath = CurrentProject.Path
strSourceFile = Me.cboClienti
strDestPath = strPath & "\nuovaCartella"
If Not FileExists(strPath & "" & strSourceFile) Then
VBA.MsgBox "il file non esiste", vbCritical, "Attenzione"
Exit Sub
End If
If FileExists(strDestPath & strSourceFile) Then
If VBA.MsgBox("Il file :" & vbNewLine & _
strDestPath & strSourceFile & " è già esistente, confermi la sovrascrittura?", vbInformation + vbOKCancel) = vbCancel Then
VBA.MsgBox "Nessuna sovrascrittura effettuata!", vbInformation, "Avviso"
Exit Sub
End If
End If
Shell "cmd /c move " & strPath & "" & strSourceFile & Chr(32) & strDestPath, vbHide
VBA.MsgBox "file sovrascritto o copiato", vbInformation, "Avviso"
exitHandler:
Exit Sub
errHandler:
With Err
MsgBox "ERR#" & .Number _
& vbNewLine & .Description _
, vbOKOnly Or vbCritical
End With
Resume exitHandler
End Sub
funzione da copiare in un modulo pubblico :
Public Function FileExists(strPathFile As String) As Boolean
On Error Resume Next
FileExists = ((GetAttr(strPathFile) And vbDirectory) = 0)
End Function
ciao, Sandro.