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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top