Results 1 to 13 of 13
  1. #1
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365

    Get Extended property for specific file

    The property I want is bitrate which I think is 28 but if the following would work I can confirm that
    Code:
    Dim oShell As Object
    Dim oDir As Object
    Dim objFile As Object
    Set oShell = CreateObject("Shell.Application")
    Set oDir = oShell.Namespace("D:\01.flac")
    
    
    For Each objFile In oDir.Items
       Debug.Print oDir.GetDetailsOf(objFile, 20)
    Next
    I'm not familiar with this code and get the following error
    -2147467259 Automation error
    Unspecified error



    Can anyone correct what's wrong? Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    Is "D:\01.flac" a file or a folder?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    Yes it did June, thanks, and this is just what I wanted
    Code:
    Function trythis(f, ByRef x) As Integer
        With CreateObject("Shell.Application").Namespace(GetPath(f))
            trythis = Val(Mid(.GetDetailsOf(.Items.Item(StripPath(f)), 28), 2))
            x = .GetDetailsOf(.Items.Item(StripPath(f)), 27)
        End With
    End Function
    28 is Bitrate but also I also want Filesize and that's not 27 (which is Duration)
    Size is 1 but that returns "5.07 MB" which seems wrong as r-click properties shows 10.8 MB (11,364,469 bytes)
    and it's the full 11364469 I'm after (with or without the comas).
    Is it possible ?
    (Strip and GetPath return the path and name for f which is a .flac file). x is a Variant.

  5. #5
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    @Welshgasman it was a file.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    Quote Originally Posted by Middlemarch View Post
    @Welshgasman it was a file.
    Yet oDir is meant to be a folder?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    I see, yes. oops.
    I have a new routine now in msg4 which is working.. if I find the index number for LOF.

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938

  9. #9
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Size is 1 but that returns "5.07 MB" which seems wrong as r-click properties shows 10.8 MB (11,364,469 bytes)
    What are you using to see 5.07 - tag editing software? If so, could 5 be the compressed size and Windows right click is the uncompressed size?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    I get the 5.07 from the code in Msg 5 where f is a flac file.
    I'm guessing file size in bytes isn't returned as an extended property.
    This works - Open File For Binary As #ffebug.print LOF(ff)
    but I wanted to see if another method may be quicker.

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    File size is returned as extended property 1. Bitrate is indeed property 28.
    There are a total of 321 extended properties though no single file has all of these.

    See my Extended File Properties app referenced in post #8 to get all extended file properties for any file or groups of similar files.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #12
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    Hi Colin, yes I did read through all of those and found 1 was Size.
    But it returns it as e.g. "14.4 MB"
    What I wanted was size in bytes as per r-click-properties. 14.4 MB (15,122,809 bytes)
    The bit in brackets. Am I right thinking this can't be done ?

  13. #13
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    There is only one size property
    Just convert the quoted value to bytes where i kilobyte = 1024 bytes, 1 MB = 1024 kilobytes ...etc
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 04-08-2022, 04:32 PM
  2. Report extended sum not working
    By mafhobb in forum Reports
    Replies: 5
    Last Post: 03-21-2021, 03:15 AM
  3. Replies: 7
    Last Post: 08-14-2020, 06:55 PM
  4. Locate Extended ASCII characters
    By Whit in forum Queries
    Replies: 1
    Last Post: 04-17-2018, 03:32 PM
  5. Layout for Controls extended.
    By Perceptus in forum Forms
    Replies: 11
    Last Post: 11-12-2015, 03:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums