List files in a directory

D

David

Hi Group,

I am trying to get a list of files in the directory c:/Documents and
setting/My Documents/TestExcel

and open all of them.

Thanks,
David
 
J

Jacob Skaria

Sub FindFiles()
Dim strFile
Dim strFolder

strFolder = "c:\Documents and setting\My Documents\TestExcel\"
strFile = Dir(strFolder & "*.*", vbNormal)
Do While strFile <> ""

Msbgox strFile
'do something

strFile = Dir
Loop

End Sub
 
Top