Looping thru directory, doing something to the files in there. The problem is
that there will allways be one file which is not processed. Ie. when there
are only one file left on directory, DIR is empty. Why so?
Sub test()
ChangeFileOpenDirectory "C:\test\txt\"
Dir (activedirectory & "*.txt")
fName = Dir
While tiedosto <> ""
Documents.Open FileName:=fName
'''' do something to the file
ActiveDocument.Close
Kill fName
Dir (activedirectory & "*.txt")
fName = Dir
Wend
End Sub
Jezebel - 27 Mar 2006 07:26 GMT
Once you've called DIR() with an argument, you then get further matches by
calling it with NO argument --
fName = Dir (activedirectory & "*.txt")
Do until len(fName) = 0
... do whatever
fName = Dir
Loop
> Looping thru directory, doing something to the files in there. The problem
> is
[quoted text clipped - 14 lines]
> Wend
> End Sub