Cleaning up text copied from eBooks into MS Word

42763897005_59ee30b8c0

My preference for reading books is ebooks over printed books. One thing I like about eBooks is the ability to copy and paste chunks of text into Word documents, that I use to summarize the books for better retention. Often times the text contains arbitrary spaces inbetween words, hyphenation, and or word wraps after being pasted into word, though.:

cleanupWordBefore

In this post I would like to share a small Word Macro I use in order to “cleanup” text after it’s being pasted into a Word document from an eBook. Running the macro should turn the example text into this:

cleanupWordAfter.

The macro is just using the VBA built-in Find method in order to perform multiple successive search and replace actions against a selected text.
utili

  1. Insert a marker at the end of the selected text “®®”.
  2. Replace the paragraph mark “^p” with a space.
  3. Utilize a regular expression in order to replace multiple spaces between words with one.
  4. Remove hyphenation.
  5. Replace the end marker with a paragraph mark.
  6. Remove spaces that precede a period.
  7. Remove formatting by applying the “Normal” style to the selected text

You can follow the instructions from this youtube video to add the macro to your global word template (normal.dotm) in order to make it available for all your Word document and those over here to add a button to Word’s quick access bar that launches the Macro.

Here is the code:

shareThoughts


Photo Credit: hans-johnson Flickr via Compfight cc

Advertisements

I'd love to hear what you think

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s