Using VBA to get extended file attributes

You say loop .. so if you want to do this for a dir instead of the current document; Dim sFile As Variant Dim oShell: Set oShell = CreateObject(“Shell.Application”) Dim oDir: Set oDir = oShell.Namespace(“c:\foo”) For Each sFile In oDir.Items Debug.Print oDir.GetDetailsOf(sFile, XXX) Next Where XXX is an attribute column index, 9 for Author for … Read more

How to access a file’s properties on Windows?

Here is a function which reads all file attributes as a dictionary: import win32api #============================================================================== def getFileProperties(fname): #============================================================================== “”” Read all properties of the given file return them as a dictionary. “”” propNames = (‘Comments’, ‘InternalName’, ‘ProductName’, ‘CompanyName’, ‘LegalCopyright’, ‘ProductVersion’, ‘FileDescription’, ‘LegalTrademarks’, ‘PrivateBuild’, ‘FileVersion’, ‘OriginalFilename’, ‘SpecialBuild’) props = {‘FixedFileInfo’: None, ‘StringFileInfo’: None, ‘FileVersion’: None} try: … Read more