Sub FileInfoCollection()
Dim colFiles As Collection
Dim objFileInfo As FileInformation
Dim strFile As String
Dim vntFile As Variant
Set colFiles = New Collection
strFile = Dir("c:\")
Do Until Len(strFile) = 0
Set objFileInfo = New FileInformation
objFileInfo.FullFileName = strDirName & strFile
colFiles.Add objFileInfo
strFile = Dir()
Loop
For Each vntFile In colFiles
Debug.Print vntFile.Drive, vntFile.Path, vntFile.Name
Next vntFile
End Sub
|