|
- Sub ll()
- Dim Sht As Worksheet, Rng As Range
- Set Sht = Sheet1
- Set Sht = Sheet1
- Sht.Cells.Clear
- Sht.Cells.Font.Size = 9
- Set Rng = Sht.Cells(1, 2)
- TraverserJPG Rng, "D:"
- End Sub
- Function TraverserJPG(Rng As Range, FolderPath)
- ''
- 'Debug.Print Rng.Address
- ''
- Dim FSO As Scripting.FileSystemObject
- Dim oFile As File, oFilesAs As Files
- Dim oFolder As Folder
- Dim Img As WIA.ImageFile
- Dim oDate As Date
- Dim Rr, Cc
- Dim Str
-
- Set Img = New WIA.ImageFile
- ''
- Rr = Rng.Row + 2
- Cc = 1
- Set FSO = New Scripting.FileSystemObject
- Set oFolder = FSO.GetFolder(FolderPath)
- ''
- For Each oFile In oFolder.Files
- '
- With Rng
- If InStr(oFile.Name, "JPG") > 0 Then
- Img.LoadFile oFile.Path
- Debug.Print Rng(Rr, 1).Address, Rng.Parent.Name,
- Rng(Rr, 1) = oFile.Name
- Debug.Print oFile.Name, oFile.Path
- Rng(Rr, 2) = oFile.DateLastModified
- Rng(Rr, 3) = Img.Width
- Rng(Rr, 4) = Img.Height
- Rng(Rr, 5) = Format(Int(oFile.Size / 1024), "0,000")
- Rng(Rr, 6) = ThisWorkbook.Path & "" & oFile.Name
- Rr = Rr + 1
- End If
- End With
- Next oFile
- ''
- For Each oFolder In oFolder.SubFolders
- TraverserJPG Rng(Rr, 1), oFolder.Path
- Next oFolder
- End Function
- ''
复制代码
|
|