Using common dialog to display items in listbox

jester3397
06-01-2010, 12:50 PM
I'm using a COMDLG32.DLL to open a dialog control.

What I'm trying to do is for the user to select a path/location. Then once I retrieve the path get all the file names in that path with *.txt into a listbox?

Is this possible?

elmonkfish
06-03-2010, 08:57 AM
something like this will loop thru each file in a folder and check if the extension is .txt. If it is the file name is added to the listbox.


Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim objFile As File

Set objFSO = New FileSystemObject
Set objFolder = objFSO.GetFolder(sFolderSpec)

For Each objFile In objFolder.Files
If objFSO.GetExtensionName(objFile.Name) = "txt" Then
Call ListBox1.AddItem(objFile.Name)
End If
Next objFile

Set objFolder = Nothing
Set objFSO = Nothing


hope this helps

jester3397
06-04-2010, 01:40 PM
Thanks, I'll give it a shot.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum