Results 1 to 2 of 2
2014-12-30, 11:51 #1
- Join Date
- Dec 2014
- Thanked 0 Times in 0 Posts
.GetDetailsOf Code Doesn't Display Filenames, But Still Works - How To Modify?
I was testing the code found in the following thread and ran into a minor issue. The code asks the user to Select a folder and displays a list of folders, but no filenames. Folders will always be displayed as the user drills down, but filenames are never displayed. If the user eventually drills down to a folder that only contains files, he is presented with an empty pane and a "No items match your search" message. However, clicking OK does indeed import all of the requested details for every file in the folder.
Is there a way to modify the code so that the folder window displays the filenames? This would help the user know that he is in the right folder. If individual filenames could be chosen, that would be even better, but at a minimum, it would be beneficial to at least see the filenames.
Here is the code from that thread, with credit given to sdckapr:
Sub GetDetails() Dim oShell As Object Dim oFile As Object Dim oFldr As Object Dim lRow As Long Dim iCol As Integer Dim vArray As Variant vArray = Array(0, 31, 1, 163) '0=Name, 31=Dimensions, 1=Size, 163=Vertical Resolution Set oShell = CreateObject("Shell.Application") lRow = 1 With Application.FileDialog(msoFileDialogFolderPicker) .Title = "Select the Folder..." If .Show Then Set oFldr = oShell.Namespace(.SelectedItems(1)) With oFldr For iCol = LBound(vArray) To UBound(vArray) Cells(lRow, iCol + 1) = .getdetailsof(.items, vArray(iCol)) Next iCol For Each oFile In .items lRow = lRow + 1 For iCol = LBound(vArray) To UBound(vArray) Cells(lRow, iCol + 1) = .getdetailsof(oFile, vArray(iCol)) Next iCol Next oFile End With End If End With End Sub
Last edited by DerbyDad03; 2014-12-30 at 11:56. Reason: Code added for convenience
2015-01-01, 08:25 #2
- Join Date
- Apr 2014
- Austin, TX
- Thanked 36 Times in 34 Posts