Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dir() skipping alternate files in a directory!

Status
Not open for further replies.

MikeRussell

Programmer
Apr 22, 2001
16
0
0
AU
I have got some code that should cycle through a directory returning every *.rtf file name in turn, but it skips every other one.

Thier are forty *.rtf files in the directory, but only 20 get returned, being alternate ones.

The relevant section of the code is:

myfile = ""

Do
If myfile = "" Then '1st loop
myfile = Dir("x:\SAFA\Development\Mike\*.rtf")
Else
myfile = Dir
End If

Code segment here is not relevant (I think) to the problem

Loop While Dir <> ""



 
OK I have sorted it out. Sorry if I wasted anybodies time.

I should not be doing 'Loop While Dir <> ""' as this does in fact carry out another Dir request, but should use 'Loop while MyFile <> ""'

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top