Code to get all the mdb files in a folder

can someone give me a vb code that i can insert into macro of excel vba. This code should give the names of all the mdb files inside a folder..

Summary: code to return the path and name of mdb files inside a folder at certain path.
Who is Participating?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
dim fso as object
dim folder as object
dim file as object
set fso = createobject("scripting.Filesystemobject")
set folder = fso.GetFolder("C:\yourfolder\")
for each file in folder.files
  if ucase( like "*.MDB" then
     debug.print file.path,
  end if
AiyshaAuthor Commented:
where do I see the results?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
in the debug window.
instead of  debug.print you can do other things with the file object's properties...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.