Public Function getFileMetadata(fileFolder As String, fileNm As String, metadataType As String) As String
Dim objShell As SHELL32.Shell
Dim objFolder As SHELL32.Folder
Dim objFolderItem As SHELL32.FolderItem
Set objShell = New Shell
Set objFolder = objShell.Namespace(fileFolder)
Set objFolderItem = objFolder.ParseName(fileNm)
[COLOR=Green] 'I WAS USING THIS FOR .JPG FILES[/COLOR]
If metadataType = "photo" Then
Dim cTxt as String
cTxt = "Dimensions: " & objFolder.GetDetailsOf(objFolderItem, 26)
cTxt = cTxt & vbCrLf & "Date Picture Taken: " & objFolder.GetDetailsOf(objFolderItem, 25)
cTxt = cTxt & vbCrLf & "Camera Model: " & objFolder.GetDetailsOf(objFolderItem, 24)
cTxt = cTxt & vbCrLf & "Type: " & objFolder.GetDetailsOf(objFolderItem, 2)
cTxt = cTxt & vbCrLf & "Size: " & objFolder.GetDetailsOf(objFolderItem, 1)
getFileMetadata = cTxt
ElseIf metadataType = "DatePicTaken" Then
getFileMetadata = objFolder.GetDetailsOf(objFolderItem, 25)
Else
getFileMetadata = objFolder.GetDetailsOf(objFolderItem, 1)
End If
Set objFolderItem = Nothing
Set objFolder = Nothing
Set objShell = Nothing
[COLOR=Green]'Properties and index:
'================
'0 Name
'1 Size
'2 Type
'3 Date Modified
'4 Date Created
'5 Date Accessed
'6 Attributes
'7 Status
'8 Owner
'9 Author
'10 Title
'11 Subject
'12 Category
'13 Pages
'14 Comments
'15 Copyright
'16 Artist
'17 Album Title
'18 YEAR
'19 Track Number
'20 Genre
'21 Duration
'22 Bit Rate
'23 Protected
'24 Camera Model
'25 Date Picture Taken
'26 Dimensions
'27
'28
'29 Episode Name
'30 Program Description
'31
'32 Audio sample size
'33 Audio sample rate
'34 Channels
'35 Company
'36 Description
'37 File Version
'38 Product Name
'39 Product Version
'40 Keywords[/COLOR]
End Function