[AccessD] A2K: Loop through files in a folder

Darren DICK d.dick at uws.edu.au
Tue Feb 4 20:01:00 CST 2003


Hello all
I have the following code in my forms timer, modified from the
help, that gives me a MsgBox with all the files in a folder. So far so good

I have the timer set for 5 seconds. What I want is for the routine to show the
next file name in a MsgBox every 5 seconds. But what is happening with this
code is I get as many MsgBox's as there are files every 5 seconds (by 
keeping the enter key pressed)

How can I pause the FOR - NEXT code for 5 seconds??
Or have it show 1 file every 5 seconds not every file in 5 seconds

Any suggestions??

Many thanks in advance
Darren
++++++++++++++++++++++++++++++
Sub ShowFilesInDir(strFolder As String)
   Dim fs, f, f1, fc, s
     Set fs = CreateObject("Scripting.FileSystemObject")
     Set f = fs.GetFolder(strFolder)
     Set fc = f.Files

     For Each f1 In fc
         s = f1.Name
     Next

     MsgBox s

End Sub
++++++++++++++++++++++++++++++




More information about the AccessD mailing list