• Document Titles (Word XP)

    Author
    Topic
    #378101

    I have a large number (>1000) of files which have been created using codes for the file names. The real details are contained in the document titles.

    Is there a VBA routine (I’m not a VBA programmer) that would allow me to extract all the titles into another file? Any help would be much appreciated.

    Regards,

    Ian

    Viewing 0 reply threads
    Author
    Replies
    • #624935

      When you say the document title – do you mean in the document property or embedded somewhere in the document with the style “Title”?

      Either way can certainly be done with VBA but we would need to know exactly where the title should come from.

      • #624986

        Thanks, Andrew.

        It is the document property.

        Regards,

        Ian

        • #625129

          Try the following Macro

          Sub TitlesList()

          Dim FS, FO, FL As Variant
          Dim ListString As String

          Set FS = CreateObject(“Scripting.FileSystemObject”)
          Set FO = FS.getfolder(ActiveDocument.Path)
          For Each FL In FO.Files
          If Right(FL.Name, 4) = “.doc” Then
          Documents.Open FileName:=FL.Name, ReadOnly:=True
          ListString = ListString & vbCrLf & _
          FL.Name & “, ” & _
          ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)
          ActiveDocument.Close savechanges:=False
          End If
          Next
          Documents.Add
          ActiveDocument.Paragraphs(1).Range.InsertBefore ListString
          End Sub

          • #625290

            Hi Andrew,

            Thanks very much for the script. It ran fine and I’ve now managed to grab most of the titles and catalogue the files.

            I have an Excel utiliy that lists directories and creates hyperlinks to each file. With the output from your macro, I am now able to use VLOOKUP to obtain the titles.

            Again, thanks very much. Your help was much appreciated.

            Regards,

            Ian

    Viewing 0 reply threads
    Reply To: Document Titles (Word XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: