TheWennerWoman
Active Member
- Joined
- Aug 1, 2019
- Messages
- 301
- Office Version
- 365
- Platform
- Windows
I have this
If there are no files to move, I'd like to exit gracefully. I added in the bit above but it doesn't like it.
What am I doing wrong?
Thanks in advance as always
VBA Code:
Sub MoveFiles()
Dim FSO As New FileSystemObject
Set FSO = CreateObject("Scripting.FileSystemObject")
' specify source and destination folders
sourcefile = "W:\COYA\interfaces\PAMLoader\failed\*"
DestFile = "W:\COYA\interfaces\PAMLoader\input\"
If sourcefile Is Nothing Then ' errors here with "Object Required"
MsgBox "No files to process!"
Exit Sub
End If
' move all files from source folder to destination folder
FSO.MoveFile Source:=sourcefile, Destination:=DestFile
End Sub
If there are no files to move, I'd like to exit gracefully. I added in the bit above but it doesn't like it.
What am I doing wrong?
Thanks in advance as always