Consulting

Results 1 to 10 of 10

Thread: getdetailsof - method or data member not found

  1. #1
    VBAX Newbie
    Joined
    Feb 2024
    Posts
    4
    Location

    getdetailsof - method or data member not found

    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 : 0001.JPG


    I don't know what I should change / update. Does anyone know what could be the solution?

    Thanks!!!

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,721
    Location
    I'm guessing that "DateTaken" variable means that you're dealing with pictures

    The Details IDs have changed over the versions

    Capture.JPG
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,241
    Location
    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.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2405, Build 17628.20102

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,736
    Location
    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?
    Be as you wish to seem

  5. #5
    VBAX Newbie
    Joined
    Feb 2024
    Posts
    4
    Location
    Quote Originally Posted by georgiboy View Post
    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!!!

  6. #6
    snb
    Guest
    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

  7. #7
    VBAX Newbie
    Joined
    Feb 2024
    Posts
    4
    Location
    Quote Originally Posted by snb View Post
    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!

  8. #8
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,721
    Location
    Depending on which verson of Windows, it's most likely 12 or 25 - probably 12

    See post #2
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  9. #9
    VBAX Newbie
    Joined
    Feb 2024
    Posts
    4
    Location
    Quote Originally Posted by Paul_Hossler View Post
    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....

  10. #10
    snb
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •