I want to move a file from one folder to another, the macro fails in the last line, any help would be appreciated
Sub a_Move_File()
Dim Ans As String
Sub a_Move_File()
Dim OldFol As String
Dim NewFol As String
Dim filnam As String
Dim OldNam As String
Dim NewNam As String
'Source folder address in P3 in the form "C:\PaidNotEntered"
OldFol = Range("P3").Value
'Destination folder in p4
NewFol = Range("P4").Value
'Filename in the form "test.pdf"
filnam = ActiveCell.Value
' Concatenated Source folder and filename in the form "C:\PaidNotEntered\test.pdf"
OldNam = OldFol & filnam
' Concatenated Destination folder and filename
NewNam = NewFol & filnam
Name OldNam As NewNam
End Sub
Sub a_Move_File()
Dim Ans As String
Sub a_Move_File()
Dim OldFol As String
Dim NewFol As String
Dim filnam As String
Dim OldNam As String
Dim NewNam As String
'Source folder address in P3 in the form "C:\PaidNotEntered"
OldFol = Range("P3").Value
'Destination folder in p4
NewFol = Range("P4").Value
'Filename in the form "test.pdf"
filnam = ActiveCell.Value
' Concatenated Source folder and filename in the form "C:\PaidNotEntered\test.pdf"
OldNam = OldFol & filnam
' Concatenated Destination folder and filename
NewNam = NewFol & filnam
Name OldNam As NewNam
End Sub