Consulting

Results 1 to 3 of 3

Thread: Highlight specifc text plus 15 characters afterwards

  1. #1

    Highlight specifc text plus 15 characters afterwards

    Hi,

    1. I would like to highlight all the words "Specification" and "red marked"(30 characters) items along with it in the attached file. It has 1000+ pages. Need macro to highlight all occurrences. i.e(specification+30characters)

    2. Is it possible to insert the Red marked Specification into the table next to "Range" column in word?

    3.Can we export the specification along with 30 characters and its file name as separate column in excel file?


    Please through some VBA action into this task.
    Attached Files Attached Files
    Last edited by gentle2005; 10-18-2016 at 01:05 AM.

  2. #2
    1: -
    Sub HighlightSpec()
    Dim oRng As Range
        Set oRng = ActiveDocument.Range
        With oRng.Find
            .Font.ColorIndex = wdRed
            Do While .Execute(Forward:=True)
                If Len(oRng) > 1 Then
                    oRng.Start = oRng.Start - 14
                    oRng.HighlightColorIndex = wdTurquoise
                    'Debug.Print oRng.Text
                End If
                oRng.Collapse 0
            Loop
        End With
    lbl_Exit:
        Exit Sub
    End Sub
    2: - No idea what that means
    3: - Probably, but you'll have to clarify what exactly you want and where you want it.
    Within the loop, oRng.text is the specification and the preceding characters.
    Which Filename?
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    Thanks. I am sorry I could not explain you well .Actually I want to convert the attached word file into excel data list as attached.
    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
  •