標題:
[發問]
擷取JPG的拍攝時間
[打印本頁]
作者:
modelcrazyer
時間:
2016-10-9 22:34
標題:
擷取JPG的拍攝時間
請問各位大大:
我想用Excel擷取出"C:\temp"中所有JPG檔拍攝的時間,請問該從哪裡下手
謝謝!
作者:
zyzzyva
時間:
2016-10-11 18:24
回復
1#
modelcrazyer
網路上的範例改的,參考看看。
Sub getDetailsOfFile()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim myShl As New Shell
Dim curFolder As Folder
Dim theItm As FolderItem
Dim Fn As Variant
Dim theTitle As String
Dim outStr As String
tarPath = "C:\Temp"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(tarPath)
Set curFolder = myShl.Namespace(tarPath)
For Each objFile In objFolder.Files
If Right(objFile.Name, 3) = "JPG" Or Right(objFile.Name, 3) = "jpg" Then
With curFolder
fName = objFile.Name
theTitle = .GetDetailsOf(fName, 12)
If .GetDetailsOf(.Items.Item(fName), 12) <> "" Then
outStr = fName & vbTab & theTitle & ": " & vbTab & .GetDetailsOf(.Items.Item(fName), 12)
Debug.Print outStr
End If
End With
End If
Next objFile
Set myShl = Nothing
End Sub
複製代碼
作者:
modelcrazyer
時間:
2016-10-11 21:51
非常謝謝!!終於有個方向了!!
可惜輸出的結果是拍攝日期:?2016/?3/?26
再請問怎麼把問號去除
作者:
zyzzyva
時間:
2016-10-12 10:04
回復
3#
modelcrazyer
如果只是要取得資訊,將print出來的資料複製到筆記本裡,把?取代掉應該就可以了。
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)