Results 1 to 5 of 5

Thread: Files in Directory

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    55
    how do i get a list of all the files in a directory?

  2. #2
    Guest
    set a reference to Microsoft Scripting Runtime and add a listbox to the form then stick this code in somewhere:

    Code:
    Dim MyFSO As New FileSystemObject
    Dim MyFolder As Folder
    Dim MyFile As File
    
    Set MyFolder = MyFSO.GetFolder("C:\Windows\Desktop")
    
    For Each MyFile In MyFolder.Files
        List1.AddItem MyFile.Name
    Next MyFile
    Nice and quick! Read up on the FSO to find out more of the cool stuf it does. (its loads better than the DIR() function).


  3. #3
    Lively Member
    Join Date
    May 2000
    Posts
    65
    wossname's reply looks good
    perhaps he can tell me how to set a reference to Microsoft Scripting Runtime
    cheers

  4. #4
    Guest
    yep,

    click on the Project menu and then click Refernces (theres no keyboard shortcut that I know of) you will find a whole bunch of useful DLL's and bits, find the one named "Microsoft Scripting Runtime" and check the box next to it.

    the first thing you will notice is some new variable types become available.

    Hows that?

  5. #5
    Lively Member
    Join Date
    May 2000
    Posts
    65
    cheers wossname
    looks very useful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width