返回列表 上一主題 發帖

[發問] 擷取JPG的拍攝時間

回復 1# modelcrazyer
網路上的範例改的,參考看看。
  1. Sub getDetailsOfFile()
  2. Dim objFSO As Object
  3. Dim objFolder As Object
  4. Dim objFile As Object
  5. Dim myShl As New Shell
  6. Dim curFolder As Folder
  7. Dim theItm As FolderItem
  8. Dim Fn As Variant
  9. Dim theTitle As String
  10. Dim outStr As String

  11.     tarPath = "C:\Temp"
  12.     Set objFSO = CreateObject("Scripting.FileSystemObject")
  13.     Set objFolder = objFSO.GetFolder(tarPath)
  14.     Set curFolder = myShl.Namespace(tarPath)
  15.     For Each objFile In objFolder.Files
  16.         If Right(objFile.Name, 3) = "JPG" Or Right(objFile.Name, 3) = "jpg" Then
  17.             With curFolder
  18.                 fName = objFile.Name
  19.                 theTitle = .GetDetailsOf(fName, 12)
  20.                 If .GetDetailsOf(.Items.Item(fName), 12) <> "" Then
  21.                     outStr = fName & vbTab & theTitle & ": " & vbTab & .GetDetailsOf(.Items.Item(fName), 12)
  22.                     Debug.Print outStr
  23.                 End If
  24.             End With
  25.         End If
  26.     Next objFile

  27.     Set myShl = Nothing

  28. End Sub
複製代碼

TOP

回復 3# modelcrazyer
如果只是要取得資訊,將print出來的資料複製到筆記本裡,把?取代掉應該就可以了。

TOP

        靜思自在 : 虛空有盡.我願無窮,發願容易行願難。
返回列表 上一主題