-
Public Function FileFinder(WatchingDir As String)
Dim filename As String
FileFinder = Dir(WatchingDir)
Do Until FileFinder = ""
filename = FileFinder
If filename <> "" Then
Text1.Text = "Processing " & filename
MoveDir (filename)
End If
FileFinder = Dir
Loop
End Function
When I run the above code I get this error:
Run-Time error '5'
Invalid procededure call or argument
on this line
FileFinder = Dir
Any suggestions??
-
try this:
filefinder = Dir()
-
Did not work, still the same error. Thanks for the help though.
-
You will get that error whenever you didn't specify which directory you search first.
Code:
FIleFinder=Dir(YourPath)
Then you can use Dir to find the next files or directories
-
I have that, but it won't loop through the directory with the MoveDir(filename) code in it. It gets stuck on the first file and won't do or move anywhere else. With the MoveDir(filename) not there it loops through the directory just fine.
-
How am i suppose to know what you have in MoveDir()?
-
try this
Try a on error resume next