Getting Run-time error when i try to move a file. The file is in my documents, and within documents there is a folder called "Archive", which is where im trying to move. As you can see in the last part of the code, I've added the text "Archive" to the file path so that there is a new file path. Can someone explain why this error occurs?
Public wb As Workbook
Public ws As Worksheet
Public SourceFile_Location
Public srcWB As String
Public srcWB_sheet As String
Sub Full_Code()
Call DataFile
Call test2
End Sub
Sub DataFile()
SourceFile_Location = Dir("C:\Users\Asad\Documents\*.xl??")
Set wb = Workbooks.Open(SourceFile_Location)
Set ws = wb.Worksheets(1)
srcWB = wb.Name
srcWB_sheet = ws.Name
End Sub
Sub test2()
wb.Activate
fpath = ActiveWorkbook.Path
fpathnew = fpath & "\Archive"
ActiveWorkbook.Close
Name fpath As fpathnew & "\" & srcWB ***<- this is where my error is***
End Sub