devxlogo

GetFiles – Returns all the files in a directory

GetFiles – Returns all the files in a directory

' Returns a collection holding all the filenames that' match a given filespec and search attributes.Function GetFiles(filespec As String, Optional Attributes As VbFileAttribute) _    As Collection    Dim filename As String        Set GetFiles = New Collection        ' start the search    filename = Dir$(filespec, Attributes)        Do While Len(filename)        ' we've found a new file        GetFiles.Add filename, filename        ' get ready for the next iteration        filename = Dir$    LoopEnd Function

devx-admin

Share the Post: