• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

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.
0
Aiysha
Asked:
Aiysha
  • 2
1 Solution
 
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(file.name) like "*.MDB" then
     debug.print file.path, file.name
  end if
next
0
 
AiyshaAuthor Commented:
where do I see the results?
0
 
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...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now