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

Ask a Question

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.