grep X>Y>..>Z format on word documents

Discussion in 'Word Programming' started by cxleung@gmail.com, Oct 28, 2011.

  1. Guest

    Hi All

    I have 100+ User Manual, in each manual menu selection in below format
    X>Y Menu A for ...
    run X>Y>1 Menu C update ...
    try X>1>A>1 Menu B ...
    X>2>A>2 Menu a ....
    ...
    or combination

    Some menu in table.
    The color of menu selection in blue color

    Some to programming grep those menu ?
    output format
    File name , Menu selection
    e.g.
    A.doc ,X>Y Menu A
    .....

    moonhkt
     
    , Oct 28, 2011
    #1
    1. Advertisements

  2. moonhkt Guest

    Hi All

    Below is coding for select Text with color and within color string have ">". It will grep active document with this format.



    Sub reportxx()
    Dim i As Integer
    Dim aDoc As Document
    Dim getStr As String
    Dim ystr As String
    Dim xcolor As Integer
    Set aDoc = ActiveDocument
    ' MsgBox ActiveDocument.Name
    xcolor = 0
    For i = 1 To aDoc.Characters.Count
    If aDoc.Range.Characters(i).Font.ColorIndex <> 0 Then
    xcolor = 1
    Else
    xcolor = 0
    End If

    If xcolor = 1 Then
    If aDoc.Range.Characters(i) <> Chr(13) Then
    If getStr = "" Then getStr = ActiveDocument.Name & " - "
    getStr = getStr & aDoc.Range.Characters(i)
    End If
    Else
    If InStr(getStr, ">") > 0 Then
    If Trim(getStr) <> "" Then
    ystr = ystr & getStr & Chr(13)
    End If
    End If
    getStr = ""
    End If
    Next
    MsgBox ystr
    End Sub
     
    moonhkt, Nov 19, 2011
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Garry Kessler

    Compare Documents problem Word 2000

    Garry Kessler, Sep 13, 2003, in forum: Word Programming
    Replies:
    0
    Views:
    138
    Garry Kessler
    Sep 13, 2003
  2. Jason Madison

    Word Documents, IFrames, HTAs and Hyperlinks!

    Jason Madison, Apr 22, 2004, in forum: Word Programming
    Replies:
    0
    Views:
    136
    Jason Madison
    Apr 22, 2004
  3. =========== XYZ ===========

    Embedded hidden dates in Word documents.

    =========== XYZ ===========, Jul 27, 2004, in forum: Word Programming
    Replies:
    1
    Views:
    119
    Kevin Mitchell
    Jul 30, 2004
  4. Replies:
    1
    Views:
    118
    OYTUN ASKIN
    Feb 25, 2005
  5. Replies:
    0
    Views:
    206
  6. Terry

    VBA Date Format to Word Doc Date Format

    Terry, Aug 12, 2009, in forum: Word Programming
    Replies:
    2
    Views:
    378
    Terry
    Aug 12, 2009
  7. SanCarlosCyclist

    Append Many Word Documents into a Single Word Document

    SanCarlosCyclist, Mar 20, 2010, in forum: Word Programming
    Replies:
    1
    Views:
    178
    Doug Robbins - Word MVP
    Mar 21, 2010
  8. Nimmi Srivastav

    Word macro with unix grep like function

    Nimmi Srivastav, Jun 10, 2010, in forum: Word Programming
    Replies:
    3
    Views:
    553
    Graham Mayor
    Jun 11, 2010
Loading...