Results 1 to 2 of 2

Thread: Why does this code skip a file in the loop ?????

  1. #1

    Thread Starter
    Addicted Member Redangel's Avatar
    Join Date
    Oct 2005
    Location
    England
    Posts
    214

    Question 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:
    1. DirPath = App.Path & "\Client Files\*.rtf"
    2.     DirFiles = Dir(DirPath, vbNormal)
    3.     For Loop1 = 1 To Val(Dir)
    4.         ClientNum = Val(DirFiles)
    5.         FileNum = FreeFile
    6.         Debug.Print ClientNum
    7.         DirFiles = Dir

    Please help

  2. #2
    New Member
    Join Date
    Jan 2006
    Posts
    4

    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 )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width