Forum Discussion
How to read file properties. Old method stopped working after update.
Hi,
my workbooks suddenly stopped working after an Windows/Excel update.
I used Excel VBA to read the file properties of files in a folder, without opening them.
Now the same code is just returning the basic properties, like title, dates, etc.
What I need is the 'Comments' value.
Seems to me like the https://msdn.microsoft.com/en-us/library/windows/desktop/ff468984(v=vs.85).aspxhas been changed? This is critical.
Is there a new way to get *all* the properties?
I have Windows 10 Enterprise with Office 365.
Here's my test code, just change path:
Sub testGetDetailsOf()
Dim objShell, objFolder, objFolderItem, item
Dim i As Integer
Set objShell = CreateObject("shell.application")
Set objFolder = objShell.Namespace("C:\test")
If (Not objFolder Is Nothing) Then
For Each item In objFolder.items
Set objFolderItem = objFolder.ParseName(item.Name)
If (Not objFolderItem Is Nothing) Then
For i = 0 To 100
Debug.Print i & " " & objFolder.GetDetailsOf(objFolderItem, i)
Next
End If
Set objFolderItem = Nothing
Next
End If
Set objFolder = Nothing
Set objShell = Nothing
End Sub
2 Replies
- Mark HodkinsonCopper Contributor
Hi,
I am seeing the same problem with all but the initial properties (circa 6) returning as blank.
It appears very machine build specific as the code is running on some machines and not on others.
Did you ever get a solution for this Eirik?
Alternatively, can anyone suggest the quickest alternative solution for returning the File properties from a remote shared server space?
- Eirik G. JensenCopper Contributorhi, I haven't found a solution yet. It seems like a pretty serious error by MS.
My only workaround is for the code to open each workbook and use:
For Each fil In oFolder.Files
Set wb = Workbooks.Open(file.path)
debug.print wb.BuiltinDocumentProperties("comments")