Solved

Retreiving a list of files from a directory

Posted on 2002-06-24
2
158 Views
Last Modified: 2010-05-02
I want to browse a certain directory on a hard drive for a certain file type.
I can do this with the FileListBox (using the Pattern and Path properties) but I want to change the display so the file extension isn't shown.
What I could really do with is an API call that returns a list or windows handles to the files in the directory.

Any ideas?

Thanks,
Andy.
 
0
Comment
Question by:HelpAndy
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 7103425
Use a listbox and the Dir() function:

Private Sub PopFiles(ByVal Pattern As String, ByVal SourcePath As String, ByRef LBox As ListBox)
  Dim strFileName As String
  LBox.Clear
  strFileName = Dir(SourcePath & "\" & Pattern)
  Do While strFileName <> ""
    LBox.AddItem Left(strFileName,Instr(strFilename,".") - 1)
    strFileName = Dir()
  Loop
End Sub

Then call like:

PopFiles "*.txt","c:\Myfolder",List1

To get a list box filled with the filenames minus the extension.
0
 

Author Comment

by:HelpAndy
ID: 7103450
You beauty, thanks Tim.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question