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?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Garry Kessler

    Compare Documents problem Word 2000

    Garry Kessler, Sep 13, 2003, in forum: Word Programming
    Replies:
    0
    Views:
    174
    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:
    239
    Jason Madison
    Apr 22, 2004
  3. =========== XYZ ===========

    Embedded hidden dates in Word documents.

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

    VBA Date Format to Word Doc Date Format

    Terry, Aug 12, 2009, in forum: Word Programming
    Replies:
    2
    Views:
    419
    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:
    213
    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:
    612
    Graham Mayor
    Jun 11, 2010
Loading...