S
SamMy
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
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