Friday, September 21, 2007

Pasting Unformatted Text in Microsoft Word

The clipboard in Microsoft Word is very powerful. It has the ability to copy and paste most of the formatting from other Microsoft Office applications, as well as much of the formatting from a website.

This isn't always what you want, however. Sometimes you simply want the text without any extra colors, fonts or other features.

Doing this in Word is fairly simple. To paste unformatted text into Microsoft Word 2003, go into Edit | Paste Special | Unformatted Text | OK.

In Word 2007, go into Home | Paste | Paste Special | Unformatted Text | OK.

This is fine if you need to perform this every once in a while.

If you plan on using the feature frequently, you'd be well served by creating a macro for this and binding it to a keyboard shortcut. If you're new to creating macros, check out our more general post on creating Word macros before trying the one below.

Writing a Macro to Paste Unformatted Text in Word 2003 and 2007.

- Word 2003

Go into Tools | Macro | Macros | Name your macro "PastePlainText" (without quotes) and click Create.

If you don't like PastePlainText, you can name this ASeriesOfTubes [wikipedia.org] for all Word cares. Just make it unique and you'll be ok.

- Word 2007

Go into the Developer Tab, then Macros. Name your macro, then click Create.

If you don't have the Developers Tab in Word 2007 you can enable it by clicking on the Office Button | Word Options | Popular | Check "Show Developer tab in the Ribbon".


(The Office Button in Word 2007)

- Word 2003 and 2007

Microsoft Visual Basic will appear, and you should see the start of your Macro in the center window:


(Click image for full size)

You should see code that looks very similar to the code below:

Sub PastePlainText()
'
' PastePlainText Macro
' Macro created 9/21/2007 by Solid Documents
'

End Sub

Change this to:

Sub PastePlainText()
'
' AutoClose Macro
' Macro created 9/21/2007 by Solid Documents
'
Selection.PasteAndFormat (wdFormatPlainText)
End Sub

(FYI, the lines that start with single quotes (') are comments. Nothing on a line that comes after ' will be run in your macro. This is useful to document how a macro works, as well as to remind yourself 6 months from now just what this macro called "ASeriesOfTubes" was supposed to do in the first place)

Next, go into File | Save Normal. Close the window.

- Word 2003

Go into Tools | Customize | Keyboard | Categories | Macros | Select PastePlainText (or whatever you named your macro).

- Word 2007

Click on the Office Button | Word Options | Customize | Customize Macros | Select PastePlainText (or whatever you named your macro as).

- Word 2003 and 2007

Click in the "Press new shortcut key" field and type the shortcut that you want to use. Ctrl+shift+v is a nice choice, given that you will be pasting something.

Click Assign, then in Word 2003 click Close | Close (in Word 2007 click Close | OK).

Your macro has been created, and you have assigned it to a keyboard shortcut. Try copying and pasting some text using your new shortcut. If you see any errors, go back and make sure you don't have any typos in your macro.