
Option Explicit
'// Moves File From One Location to Another
Public Sub MoveFile(strOldPath As String, strNewPath As String)
'// strOldPath & strNewPath must be FullPath
If strOldPath = strNewPath Then
MsgBox "Cannot MOVE a File to the Same Directory!", _
vbOKOnly + vbCritical, "Cannot Move to Same Directory!"
Else
On Error GoTo ErrMove
FileCopy strOldPath, strNewPath
Kill strOldPath
End If
Exit Sub
ErrMove:
MsgBox "Error#:=" & Err.Number & vbCrLf & _
"Discription:=" & Err.Description, _
vbMsgBoxHelpButton, "Move Error", _
Err.HelpFile, Err.HelpContext
End Sub
Sub Tester()
'// Note moving to another Dir you can Rename it!
MoveFile "C:\Test.xls", "C:\A\Test.xls"
End Sub