Using a Collection to Manipulate Multiple Instances of the FileInformation Class : Collection « Data Type « VBA / Excel / Access / Word

Home
VBA / Excel / Access / Word
1.Access
2.Application
3.Data Type
4.Data Type Functions
5.Date Functions
6.Excel
7.File Path
8.Forms
9.Language Basics
10.Math Functions
11.Outlook
12.PowerPoint
13.String Functions
14.Windows API
15.Word
16.XML
VBA / Excel / Access / Word » Data Type » Collection 
Using a Collection to Manipulate Multiple Instances of the FileInformation Class
 
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

 
Related examples in the same category
1.Create collection
2.Removing Objects from a Collection
3.Creating and Working with Custom Collections
4.Accessing an Item in a Custom Collection
5.Item method is the default method of the Collection object
6.Refer to an item in a collection using its unique key
7.Removing Items from a Custom Collection
8.Remove element with the key
9.Remove all the elements of a collection in two ways:
10.Iterating Through the Elements of a Custom Collection: use the For...Each loop to iterate through the items in a collection
11.Adding Items to a Custom Collection
12.Looping Through the Elements of a Custom Collection
13.Referencing Items in a Custom Collection
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.