Dear all,
How to copy files or folders from one location to another.
Thank you in advance..
How to copy files or folders from one location to another.
Thank you in advance..
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _ (ByVal lpExistingFileName As String, _ ByVal lpNewFileName As String, ByVal _ bFailIfExists As Long) As Long
Private Sub Com_save_gekozene_Click()
Dim i As Integer
Dim TO_FILE As String
Dim fso As New FileSystemObject
'§ folder exist?
If Not fso.FolderExists(Text_to_path.Text) Then
MsgBox ("The folder don't exist!")
Exit Sub
End If
With List_gekozene
For i = 0 To .ListCount - 1
TO_FILE = Text_to_path.Text & "\" & Mid(.List(i), InStrRev(.List(i), "\") + 1)
'§ file exist ?
If fso.FileExists(TO_FILE) Then
MsgBox TO_FILE & " file exist !"
Else
fso.CopyFile .List(i), TO_FILE
Label_status_copy.Caption = TO_FILE & " = GECOPIEERD"
DoEvents
End If
Next
End With
Label_status_copy.Caption = ""
End Sub
Comment