Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imamuddinwp/9a402b01833211772d248968150efcd3 to your computer and use it in GitHub Desktop.
Save imamuddinwp/9a402b01833211772d248968150efcd3 to your computer and use it in GitHub Desktop.
VBA to get File Names & Files Path from a folder to a Excel File; imam uddin, imamuddinwp
Sub Get_File_Names_List()
Dim Fldr As String, Fname As String
Dim ObjFldr As Object
Dim i As Long
Set ObjFldr = Application.FileDialog(4)
With ObjFldr
.Title = "Choose a folder"
.AllowMultiSelect = False
If .Show = -1 Then Fldr = .SelectedItems(1)
End With
If Fldr = "" Then Exit Sub
Fname = Dir(Fldr & "\*")
Do While Fname <> ""
i = i + 1
Cells(i, 1) = Split(Fname, ".")(0)
Cells(i, 2) = Fldr
Fname = Dir()
Loop
End Sub
@imamuddinwp
Copy link
Author

"Keyword"
"how to get a list of all files in a folder and subfolders into excel vba"
"excel vba list files in folder with specific extension"
"excel list files in folder vba"
"vba get all xls files in folder"
"vba find file in folder and subfolders"
"get the list of file names from a folder in excel"
"how to export file names from a folder to excel"
"vba print all files in folder"
Imam Uddin, imamuddinwp;
https://imamuddinwp.wixsite.com/imamuddin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment