- 帖子
- 109
- 主題
- 1
- 精華
- 0
- 積分
- 116
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2007
- 閱讀權限
- 20
- 註冊時間
- 2016-8-4
- 最後登錄
- 2018-10-22
 
|
2#
發表於 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
複製代碼 |
|