Consulting

Results 1 to 9 of 9

Thread: Extract only the title of an article (first paragraph) from a Word file using VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Mar 2021
    Posts
    4
    Location

    Extract only the title of an article (first paragraph) from a Word file using VBA

    I would appreciate your guidance in the following problem. I need to bulk extract only the articles titles from a series of publications. The idea is that I receive the files in PDF, I extract only the first page (done), and I am stuck in the last phase.


    The structure of the Word is as follows (please see two files attached):


    --- JOURNAL of MEDICINE and LIFE
    JML | REVIEW
    The role of novel poly (ADP-ribose) inhibitors in the treatment of locally advanced and metastatic Her-2/neu negative breast cancer with inherited germline BRCA1/2 mutations. A review of the literature
    Authors list, etc, etc ---


    I assume that this is the first paragraph, so I tried a workaround, but without result.

    Only the title (in bold) is needed, from each file, pasted in a different file. I can do the iteration to run the code for multiple files, that is not a problem.


    I found a similar code, but it copies every sentence from each paraghraph:


    Sub test()
    Dim doc As Document
    Dim p As Paragraph
    Dim s As String
    
    
    Set doc = ActiveDocument
    
    
    For Each p In doc.Paragraphs
        Debug.Print p.Range.Sentences(1)
    
    
    Next
    
    
    End Sub
    Many thanks in advance!
    Attached Files Attached Files

Posting Permissions

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