0

I'm trying to understand what goes wrong with the below... Bassicaly I List a series of files in an excel sheet and I'm also looking to add the tags for each file. This is not a problem for office file as I'm using the ".BuiltinDocumentProperties("Keywords").Value".

However when it comes to Pdf files I thought that it would be straight forward to use the ".GetDetailsof()" in order to get access to the extended properties.

Well... for some reason I get the below,

sValue = oDir.GetDetailsOf(oDir.Items, 18)

'Returns the "Date Modified"

While when I use the

sValue = objFile.DateLastModified
'Returns the actual Value e.g. 09/11/2012 07:01:48

Any comments or suggestions will be much appreciated.

P.S.1 I have already read the Link related to extended file attributes. I hope that I din't miss anything.

P.S.2 To be able to add values to a pdf file I use the File Meta Data

Community
  • 1
  • 1

1 Answers1

0

Here's some code which provides an overview of what properties are available and how to access them.

Adapted from: http://windowssecrets.com/forums/showthread.php/157834-VBA-FileSystemObject-Properties-Dimensions-Size-and-Vertical-resolution

Sub GetDetails()
  Dim oShell As Object
  Dim oFile As Object
  Dim oFldr As Object
  Dim lRow As Long
  Dim iCol As Integer
  Dim vArray As Variant
  vArray = Array(0, 1, 3, 4, 18)


  Set oShell = CreateObject("Shell.Application")
  lRow = 1
  With Application.FileDialog(msoFileDialogFolderPicker)
    .Title = "Select the Folder..."
    If .Show Then
      Set oFldr = oShell.Namespace(.SelectedItems(1))
      With oFldr
        For iCol = 0 To 286
          Cells(lRow, iCol + 1) = .getdetailsof(.items, iCol)
        Next iCol
        For Each oFile In .items
          lRow = lRow + 1
          For iCol = 0 To 286
            Cells(lRow, iCol + 1) = .getdetailsof(oFile, iCol)
          Next iCol
        Next oFile
      End With
    End If
  End With
End Sub
Tim Williams
  • 154,628
  • 8
  • 97
  • 125
  • Thanks for the code very convenient to check basically that the the 3 "word" files that I have under the selected folder give me all the properties as expected apart from the 1 pdf file that although I have a "Tag" and "Author " value on it the cell returns blank. – ΙΩΑΝΝΗΣ ΣΚΑΡΛΑΤΑΚΗΣ Sep 15 '16 at 18:17
  • I'm not sure if the problem occurs due to the fact that the properties on the pdf are given after installing the "File Meta data" (I have a link above) through the Rclick on the pdf file> Properties> Details> Tags – ΙΩΑΝΝΗΣ ΣΚΑΡΛΑΤΑΚΗΣ Sep 15 '16 at 18:19