Execute code througout the active document

Discussion in 'Word Programming' started by TG, May 13, 2011.

  1. TG

    TG Guest

    In a document there are a lot of comments, that I want to remove..

    Comment ar marked as:

    { This is a comment
    and it might include several lines}

    I have the code below, that will replace the next {Comment} with a
    paragraph (^p)
    But how can I have this to run through the entire document (appr.
    27000 lines)

    With Selection.Find
    .Text = "^p{"
    .Replacement.Text = "^p"
    End With
    Selection.Find.Execute
    Selection.Extend
    With Selection.Find
    .Text = "}"
    .Replacement.Text = "^p"
    End With
    Selection.Find.Execute
    Selection.TypeParagraph


    Kind regards TG
     
    TG, May 13, 2011
    #1
    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. gh
    Replies:
    0
    Views:
    96
  2. ChasAA

    Active X Controls ?

    ChasAA, Jul 24, 2006, in forum: Word Programming
    Replies:
    4
    Views:
    116
    ChasAA
    Jul 25, 2006
  3. Replies:
    1
    Views:
    145
    Jay Freedman
    Sep 8, 2006
  4. Doctorjones_md
    Replies:
    9
    Views:
    113
    doctorjones_md
    Nov 10, 2006
  5. Steve
    Replies:
    0
    Views:
    168
    Steve
    Dec 13, 2006
  6. Bruce Maston
    Replies:
    3
    Views:
    732
    Perry
    May 10, 2007
  7. mikewillnot
    Replies:
    2
    Views:
    283
    mikewillnot
    Nov 10, 2007
  8. Georgios Liakopoulos

    Wildcards in obj.ActiveDocument.Content.Find.Execute

    Georgios Liakopoulos, Mar 3, 2009, in forum: Word Programming
    Replies:
    3
    Views:
    247
    Graham Mayor
    Mar 4, 2009
Loading...