Jaafar Tribak
Well-known Member
- Joined
- Dec 5, 2002
- Messages
- 9,779
- Office Version
- 2016
- Platform
- Windows
Hi,
I was spurred to explore this subject further after this recent thread
As far as I can see, there seems to be no easy way to edit file properties programmatically without needing to resort to external components such as CDDBControl.dll or CDDBControlRoxio.dll (which by the way these two dlls don't seem to work in x64 anyway, plus they are a nightmare to install & register).There may be other 3rd party libraries that could be used but it would be great if we could read and edit file properties hassle-free and with vba alone.
So, to this end, I have been experimenting with relevant interfaces (PropertyStore, IPropertyDescription, IPropertyDescriptionList, IPropertySystem) and I seem to have come up with some pretty good results when testing in x32 and x64... I just hope it works consistently accross diff systems.
File Demo:
FileMetadataProperties.xlsm
This vba project code offers esay to use functions for reading and editing properties of all kind of files (not just media MP3s)
And
Useful headers for reference:
propsys.h
propKey.h
The code is quite long so I will be splitting it into two sections and post them in the next two following posts.
I was spurred to explore this subject further after this recent thread
As far as I can see, there seems to be no easy way to edit file properties programmatically without needing to resort to external components such as CDDBControl.dll or CDDBControlRoxio.dll (which by the way these two dlls don't seem to work in x64 anyway, plus they are a nightmare to install & register).There may be other 3rd party libraries that could be used but it would be great if we could read and edit file properties hassle-free and with vba alone.
So, to this end, I have been experimenting with relevant interfaces (PropertyStore, IPropertyDescription, IPropertyDescriptionList, IPropertySystem) and I seem to have come up with some pretty good results when testing in x32 and x64... I just hope it works consistently accross diff systems.
File Demo:
FileMetadataProperties.xlsm
This vba project code offers esay to use functions for reading and editing properties of all kind of files (not just media MP3s)
VBA Code:
Public Function GetPropertyValue( _
ByVal sPathFile As String, _
ByVal Prop As Property_Name _
) As String
And
VBA Code:
Public Function SetPropertyValue( _
ByVal sPathFile As String, _
ByVal Prop As Property_Name, _
ByVal Property_NewValue As Variant _
) As Boolean
VBA Code:
Public Function PropertyDump() As String()
VBA Code:
Public Function GetAllFileProperties(sPathFile As String) As String()
Useful headers for reference:
propsys.h
propKey.h
The code is quite long so I will be splitting it into two sections and post them in the next two following posts.