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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i place a directory's contents in an array? 1

Status
Not open for further replies.

Amadom

Programmer
Nov 16, 2001
10
0
0
I want to get the list of files in a directory into an array
 
Or you can use the Dir() method:
Code:
Sub ReadFiles()
    Dim sFiles() As String
    Dim sFile As String
    Dim iCount As Long
    iCount = 1
    sFile = Dir("C:\Temp\*.*")
    Do While sFile <> &quot;&quot;
        ReDim Preserve sFiles(iCount)
        sFiles(iCount) = sFile
        sFile = Dir
        iCount = iCount + 1
    Loop
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top