View Full Version : getdetailsof - method or data member not found
jb023
02-21-2024, 07:18 AM
Hello,
I have the following code:
Sub TestGetDetailsOf()
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.folder
Dim FileItem As Scripting.File
Dim DateTaken As Variant
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder("C:\Temp")
For Each FileItem In SourceFolder.Files
DateTaken = SourceFolder.GetDetailsOf(FileItem, 25)
Debug.Print FileItem.Name & " - Date Taken: " & DateTaken
Next FileItem
End Sub
I get because of getdetailsof the following error : method or data member not found
In references I have the following : 31368
I don't know what I should change / update. Does anyone know what could be the solution?
Thanks!!!
Paul_Hossler
02-21-2024, 08:42 AM
I'm guessing that "DateTaken" variable means that you're dealing with pictures
The Details IDs have changed over the versions
31369
georgiboy
02-21-2024, 08:57 AM
I'm not sure that the GetDetailsOf method is directly available for folders in the FileSystemObject library. It's available in the Shell object instead though:
Sub TestGetDetailsOf()
Dim FileItem As Variant
Dim oShell As Object
Dim oDir As Object
Set oShell = CreateObject("Shell.Application")
Set oDir = oShell.Namespace("C:\Temp")
For Each FileItem In oDir.Items
Debug.Print FileItem.Name & " - Date Taken: " & oDir.GetDetailsOf(FileItem, 25)
Next
End Sub
As Paul has stated above, the numbers change depending on system and versions.
Aflatoon
02-21-2024, 09:00 AM
You have the wrong code completely. The Scripting Runtime doesn't have a GetDetailsOf method anywhere. You need the Shell.Application object. What information are you actually after?
jb023
02-21-2024, 09:34 AM
I'm not sure that the GetDetailsOf method is directly available for folders in the FileSystemObject library. It's available in the Shell object instead though:
Sub TestGetDetailsOf()
Dim FileItem As Variant
Dim oShell As Object
Dim oDir As Object
Set oShell = CreateObject("Shell.Application")
Set oDir = oShell.Namespace("C:\Temp")
For Each FileItem In oDir.Items
Debug.Print FileItem.Name & " - Date Taken: " & oDir.GetDetailsOf(FileItem, 25)
Next
End Sub
As Paul has stated above, the numbers change depending on system and versions.
Thank you all for your answers. There were all good tips.
I was looking for the date taken from photos.
With the Details IDs 12 + change to the shell object, the code works fine !
I am just missing the seconds in the the date, but I guess this level of information is not saved...
Thanks again!!!
Seconds included:
Sub M_snb()
For Each it In CreateObject("Shell.Application").Namespace("G:\foto").Items
Debug.Print it.Name & " - Date Taken: " & it.Parent.GetDetailsOf(it, 31)
Next
End Sub
jb023
02-23-2024, 07:36 AM
Seconds included:
Sub M_snb()
For Each it In CreateObject("Shell.Application").Namespace("G:\foto").Items
Debug.Print it.Name & " - Date Taken: " & it.Parent.GetDetailsOf(it, 31)
Next
End Sub
Hello,
with 31, the code return the size in picxel of the pictures (in my case: "3024 x 4032") /// not the date with the seconds.
Do you know if there is still the possibility to get the date with seconds ?
Have a nice day!
Paul_Hossler
02-23-2024, 10:21 AM
Depending on which verson of Windows, it's most likely 12 or 25 - probably 12
See post #2
jb023
02-26-2024, 06:27 AM
Depending on which verson of Windows, it's most likely 12 or 25 - probably 12
See post #2
Yes, 12 is giving the date and time but goes down to minutes, not to seconds.
I was just curious if we could get the seconds....
You are the only one that can perform the test on your system:
Sub M_snb()
For Each it In CreateObject("Shell.Application").Namespace("G:\foto").Items
for j= 1 to 50
Debug.Print it.Name & " - Date Taken: " & it.Parent.GetDetailsOf(it, j)
next
Next
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.