Greetings,
I have a db built which executes a Kill statement on files it processes. This has been working perfectly on both 2013 and 2010, and still does. Now, one of my end-users was upgraded to 2016 (32-bit) and when the macro hits this function, it throws an error at the Kill statement line. Has Kill been made obsolete, or is there a Reference I may be missing in 2016, or does my syntax need to change somehow for the new version?
Code:
Public Function archive_files()
Dim d As String, ext, x
Dim srcPath As String, destPath As String, srcFile As String
srcPath = "\\drive\path\"
destPath = "\\drive\path\path\"
ext = Array("*.txt")
For Each x In ext
d = Dir(srcPath & x)
Do While d <> ""
srcFile = srcPath & d
FileCopy srcFile, destPath & d
Kill srcFile 'this is where it errors
d = Dir
Loop
Next
End Function