Here is a completely reworked version of the macro that successfully works :
Code:
Option Explicit
Sub myMacro()
Dim myFile As Object
Set myFile = CreateObject("Scripting.FileSystemObject")
Call myFile.CopyFile("C:\Users\logit\OneDrive\Desktop\Excel Repair\WinZip Registration.txt", "C:\Users\logit\OneDrive\Desktop\", True)
End Sub
Sub killFile()
Dim killFile As String
killFile = "C:\Users\logit\OneDrive\Desktop\Excel Repair\WinZip Registration.txt"
Dim Msg As String, Title As String
Dim Config As Integer, Ans As Integer
Msg = "Are You Sure ?"
Msg = Msg & vbNewLine & vbNewLine
Msg = Msg & "Changes Cannot Be Undone."
Title = "File Delete Critical !"
Config = vbYesNo + vbCritical
Ans = MsgBox(Msg, Config, Title)
If Ans = vbYes Then
If Len(Dir$(killFile)) > 0 Then
SetAttr killFile, vbNormal
Kill killFile
Else
MsgBox "File Not Found"
End If
End If
If Ans = vbNo Then Exit Sub
End Sub