Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Anonymizing a Word doc for posting (All versions)

    Posters here often wish to attach sample docs, but need to remove sensitive content. I recently needed to do the same, so came up with this quick hack. It replaces every paragraph in a document with the standard Rand() text -- "The Quick Brown Fox Jumps Over The Lazy Dog" -- but retains the paragraph's style.

    Enjoy!

    <pre>Sub RandifyActiveDocument()
    Dim para As Paragraph
    Dim rng As Range
    For Each para In ActiveDocument.Paragraphs
    If para.Range.Characters.count > 1 Then
    Set rng = para.Range
    rng.MoveEnd unit:=wdCharacter, count:=-1
    rng.Text = "The Quick Brown Fox Jumps Over The Lazy Dog"
    End If
    Next para
    End Sub
    </pre>


    Note that this doesn't affect the headers/footers, and doesn't remove comments, tracked changes, etc. (Though if someone wants to add that, sounds like a nice idea.)

  2. #2
    5 Star Lounger
    Join Date
    Jul 2003
    Location
    USA
    Posts
    728
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Re: Anonymizing a Word doc for posting (All versions)

    Thank you Andrew for this post. We will all find it helpful.

    ACM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •