|
楼主 |
发表于 2024-4-18 11:24
|
显示全部楼层
复习复习再复习,一点一点理解。
- Private Sub deldeldeldel()
- Dim Sht As Worksheet, Rng As Range
- Dim Rr, Kk As Integer
- Set Rng = Selection
- Set Sht = Rng.Parent
- With Sht.Cells
- .Clear
- .Font.Size = 9
- End With
- Rr = 10
-
- Dim oSh As Shell32.Shell
- Dim Img, ImgName
- Dim tFolder As Shell32.Folder
- Set oSh = New Shell32.Shell
-
- Dim oDir, tFile
- Dim oDate As Date
-
-
- Dim Fso As FileSystemObject
- Set Fso = New FileSystemObject
- Dim oFolder As Folder, oFile As File
- Set oFolder = Fso.GetFolder(ThisWorkbook.Path)
- Debug.Print oFolder.Name
- For Each oFile In oFolder.Files
- If UCase(oFile.Name) Like "IMG*" Then
- oDir = oFile.Path
- oDir = Left(oDir, InStrRev(oDir, ""))
- Set tFolder = oSh.Namespace(oDir)
- Set Img = tFolder.ParseName(oFile.Name)
- Debug.Print oFile.Name, oFile.DateLastModified, Img.ModifyDate
- Debug.Print "-----------"
- Debug.Print tFolder.GetDetailsOf(ImgName, 12), tFolder.GetDetailsOf(Img, 3)
- oDate = Img.ExtendedProperty("System.Photo.DateTaken")
- Debug.Print CDate(oDate) + #8:00:00 AM#
- Sht.Cells(Rr + Kk, 2) = oFile.Name
- Sht.Cells(Rr + Kk, 3) = oFile.DateLastModified
- Sht.Cells(Rr + Kk, 4) = CDate(oDate) + #8:00:00 AM#
-
- Kk = Kk + 1
- End If
- Next oFile
-
- End Sub
复制代码
|
|