...
'try to save in the hard disk
Set objFSO = CreateObject("Scripting.FileSystemObject")
Path = Environ("Tmp") & "\"
Set objFolder = objFSO.GetFolder(Path)
' Set DuplicatedMedia = AddedMedia.Duplicate
' DuplicatedMedia.Delete
For Each objFile In objFolder.Files
If Not objFile.Name Like "*TMP" Then ' 2. If Not objFile.Name Like "*TMP"
If objFile.DateCreated > (Now - TimeValue("00:00:05")) Then ' 3. If objFile.DateCreated > (Now - TimeValue("00:00:05"))
If InStr(objFile.Name, "(") Then ' 4. If InStr(objFile.Name, "(")
objFileName = Trim(Left(objFile.Name, InStr(objFile.Name, "(") - 1)) & Right(objFile.Name, Len(objFile.Name) - InStr(objFile.Name, ")"))
objFileName2 = Trim(Left(objFile.Name, InStr(objFile.Name, "(") - 1)) & " (2)" & Right(objFile.Name, Len(objFile.Name) - InStr(objFile.Name, ")"))
Else ' 4. If InStr(objFile.Name, "(")
objFileName = objFile.Name
objFileName2 = Trim(Left(objFile.Name, InStrRev(objFile.Name, ".") - 1) & " (2)" & Right(objFile.Name, Len(objFile.Name) - InStrRev(objFile.Name, ".") + 1))
End If ' 4. If InStr(objFile.Name, "(")
On Error Resume Next
Set AlreadyExists = FileSystemLibrary.GetFile(ThisWorkbook.Path & "\Save Files\" & objFileName)
On Error Resume Next
Set AlreadyExists2 = FileSystemLibrary.GetFile(ThisWorkbook.Path & "\Save Files\" & objFileName2)
If (AlreadyExists Is Nothing) And (AlreadyExists2 Is Nothing) Then FileCopy objFile, ThisWorkbook.Path & "\Save Files\" & objFile.Name ': Application.Wait (Now() + TimeValue("00:00:01"))
End If ' 3. If objFile.DateCreated > (Now - TimeValue("00:00:05"))
End If ' 2. If Not objFile.Name Like "*TMP"
objFileName = vbNullString
objFileName2 = vbNullString
Set AlreadyExists = Nothing
Set AlreadyExists2 = Nothing
Next objFile
'try to save in the hard disk
...