List files in a directory

  • Thread starter Thread starter David
  • Start date Start date
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
 
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
 
Back
Top