There are many cases where we need to get the document property without the file being opened in VBA.
This can be achieved by using the objects available in DSOFile.dll.
To begin with, add a reference to DSO Ole Document’s property library as shown in the below image.
;
Function GetPropFromDSO(ByVal sFile As String, ByVal sCP As String) As String Dim oFil As DSOFile.OleDocumentProperties Dim oCP As DSOFile.CustomProperties On Error GoTo Err_Tp Set oFil = New OleDocumentProperties oFil.Open sFile, True Set oCP = oFil.CustomProperties GetRevFromDSO = oCP(sCP) .Value oFil.Close Err_Tp: If Err ;; 0 Then Err.Clear Resume Next End If End Function
The function gets the Filename and the Property to be extracted and returns the property value.
Explore comprehensive Course on Excel Automation or VB Programming here and, learn to write VB coding with ease.
Happy Excelling
Team Excelgoodies
www.Excelgoodies.com