Created
January 16, 2021 06:36
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"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