Heelloo Frnds,
I have a code that gives me path of all files inside a folder. I want to modify it.
I want to select files (individually or in group) inside a folder and then get the path. All files are .xlsx in folder.
Please help.
Sub GetFilePath_Click()
Dim x, fldr As FileDialog, SelFold As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
If .Show <> -1 Then GoTo Cleanup
SelFold = .SelectedItems(1)
End With
x = Split(CreateObject("wscript.shell").exec("cmd /c Dir """ & SelFold & "\*.xls*"" /s/b").stdout.readall, vbCrLf)
Cells(2, 6).Resize(UBound(x)).Value = Application.Transpose(x)
Cleanup:
Set fldr = Nothing
End Sub
Thanks,
Liz
Bookmarks