Sub GetSomeFiles()
' Variable declarations
Dim sDir As String ' This is for the path/directory.
Dim sFile As String ' This is for the file(s).
Dim i As Integer ' This is a counter.
Dim coll As Collection ' This is how we'll store the files.
' Set a new instance of the collection (have to
' do this part first in order to use the collection).
Set coll = New Collection
' Set the directory here.
sDir = "C:\"
' Set the sFile variable to the Dir return (which is the
' sDir variable we just set).
sFile = Dir(sDir)
' Loop through the files while the sFile string is not Null
' (it will eventually be set to Null later in the loop).
Do While Len(sFile) <> 0
' Add the file name to the collection.
coll.Add sFile
' To get the next file in the same directory,
' set sFile to Dir again, except this time without
' an argument in the Dir function. This tells VBA to
' get the next file in the same directory. When it runs
' out of files, it will return a Null value.
sFile = Dir
' Loop (duh!)
Loop
End Sub