0

Normally I would do a simple ctrl + A, right click, and copy as path to get file names but I don't think i can within a zipped folder. Below is the VBA code I'm trying to run, but I get a "Run Time Error '76': Path not found" message. is there any way to accomplish what i'm trying to do?

Sub LoopThroughFiles()

    Dim strPathToSearch
    Dim oFSO As Object
    Dim oFolder As Object
    Dim oFile As Object
    Dim i As Integer
    
    strPathToSearch = Range("A2").Value
    'For Testing
    'MsgBox strPathToSearch
    
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    
    Set oFolder = oFSO.GetFolder(strPathToSearch)
    
    i = 4
    'For Testing
    'MsgBox (i)
    
    
    For Each oFile In oFolder.Files
    
        If oFile.Type = "Adobe Acrobat Document" Or oFile.Type = "Text Document" Then
            Cells(i, 1) = oFile.ParentFolder
            Cells(i, 2) = oFile.Name
            Cells(i, 3) = oFile.Type
            Cells(i, 4) = oFile.DateCreated
            Cells(i, 5) = oFile.DateLastModified
        
            i = i + 1
        End If
    Next oFile
End Sub
Tim Williams
  • 154,628
  • 8
  • 97
  • 125

0 Answers0