Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Dec 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .GetDetailsOf Code Doesn't Display Filenames, But Still Works - How To Modify?

    Greetings!

    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.

    http://windowssecrets.com/forums/sho...cal-resolution

    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:

    Code:
    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
    Thanks!
    Last edited by DerbyDad03; 2014-12-30 at 11:56. Reason: Code added for convenience

  2. #2
    3 Star Lounger Supershoe's Avatar
    Join Date
    Apr 2014
    Location
    Austin, TX
    Posts
    252
    Thanks
    1
    Thanked 36 Times in 34 Posts

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •