Why does this code skip a file in the loop ?????
i have a file folder with .rtf files inside it and what i want is this loop to loop though the file folder and retrive the .rtf file names but my code only reads 6 files out of 7 and then jumps out of the loop
VB Code:
DirPath = App.Path & "\Client Files\*.rtf"
DirFiles = Dir(DirPath, vbNormal)
For Loop1 = 1 To Val(Dir)
ClientNum = Val(DirFiles)
FileNum = FreeFile
Debug.Print ClientNum
DirFiles = Dir
Please help
Re: Why does this code skip a file in the loop ?????
Code:
File1.Pattern = "*.txt"
File1.Path = "C:\"
For i = 0 To File1.ListCount - 1
Text1.Text = File1.List(i)
Next i
This will give you all the filename that ends with *.rtf. (if you replace .txt to .rtf ;))