Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Oct 2002
    Location
    Greenock, Renfrewshire, Scotland
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Document Titles (Word XP)

    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

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Document Titles (Word XP)

    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.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Oct 2002
    Location
    Greenock, Renfrewshire, Scotland
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Titles (Word XP)

    Thanks, Andrew.

    It is the document property.

    Regards,

    Ian

  4. #4
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Titles (Word XP)

    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(wdPropert yTitle)
    ActiveDocument.Close savechanges:=False
    End If
    Next
    Documents.Add
    ActiveDocument.Paragraphs(1).Range.InsertBefore ListString
    End Sub

  5. #5
    New Lounger
    Join Date
    Oct 2002
    Location
    Greenock, Renfrewshire, Scotland
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Titles (Word XP)

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •