Top 4th of July Sales Best 4K Projectors 7 Early Prime Day Deals Wi-Fi Range Extenders My Favorite Summer Gadgets Cheap Car Insurance Target's 4th of July Sale Best Running Earbuds, Headphones

Create a keyboard shortcut to paste plain text

In Microsoft Word and Excel, add only the text you copy from a Web page or other source, and leave the images, formatting, and other nontext elements behind.

Last week I described the PureText utility that lets you paste plain text in Word and other applications via a keyboard shortcut. You can create a macro to get the same functionality in Word and Excel, without having to download anything.

(Note that the original post of this tip reported that PureText required that you click its icon in your system tray before you press the shortcut keys to paste plain text. This is true only if you open the destination app after the material you want to paste has been added to the clipboard. If both the source and destination programs are open when you initially copy the text, you need only press PureText's shortcut key to paste the text without images, formatting, and other non-text elements. my thanks to the reader below for pointing out this error.)

Paste plain text in Word via the keyboard
In Word 2003, click Tools*Macro*Macros. In Word 2007, click View*Macros. In both versions, type PlainPaste in the Macro name field (you can name it anything you like, but the name must begin with a letter, have no spaces, and use no punctuation), and choose Create. Place the cursor at the beginning of the line just above "End Sub" and type Selection.PasteSpecial DataType:=wdPasteText. The only space in the line is between "PasteSpecial" and "Datatype:". Press Ctrl-s to save the macro, and click File*Close and Return to Microsoft Word.

The Microsoft Visual Basic Editor screen for creating a new macro.
Type this text in the penultimate line of your macro to paste plain text.

Now test the macro: Select a mix of text and other elements in your browser or some other application, press Ctrl-c to place it on the clipboard, return to Word, click Tools*Macro*Macros in Word 2003, or View*Macros in Word 2007, select PlainPaste in the list of Macros, and click Run. Only the text should appear, in the format of the document, not of the source.

Next, assign a keyboard shortcut to the macro: In Word 2003, click Tools*Customize*Commands, make sure is selected in the "Save in" drop-down menu, and click the Keyboard button. Scroll down the Categories list in the top left and select Macros. Choose PlainPaste (or whatever you named the macro) in the right pane, click in the "Press new shortcut key" box, type Ctrl-t (or the unused key combination of your choice, beginning with Ctrl, Alt, and/or Shift), select Assign and then Close twice.

To assign the keyboard shortcut in Word 2007, click the Office button in the top-left corner, choose Word Options at the bottom of the window, click Customize in the left pane, and then the Customize button to the right of "Keyboard shortcuts" at the bottom of the Word Options dialog box. Scroll to and select Macros in the Categories window, select the PlainPaste macro in the window to the right, click in the "Create new keyboard shortcut" field, type Ctrl-t (or your choice of combination, beginning with Ctrl, Alt, and/or Shift), click Assign, then Close, and finally OK.

The Customize Keyboard options screen in Microsoft Word.
Set a keyboard shortcut for your plain-paste macro in Word.

Give Excel a plain-paste keyboard shortcut
Here's the fastest way I know of to create a plain-paste keyboard shortcut in Microsoft Excel: First, select any text and press Ctrl-c to place it in the clipboard. In Excel 2003, click Tools*Macro*Record New Macro. In Excel 2007, click View*Macros*Record Macro. Enter a name in the "Macro name" field, beginning with a character, and without any spaces or punctuation. Click in the "Shortcut key" box, type t (or the letter of your choice, as long as it isn't already assigned to a shortcut that begins with Ctrl), and press OK. In Excel 2003, click Edit*Paste Special*Text*OK, and press the Stop Recording button on the tiny toolbar that popped up when you closed the Record Macro dialog box. In Excel 2007, click Home*Paste*Paste Special*Text*OK*View*Stop Recording.

When you close Excel, you'll be asked if you want to save the changes in the Personal Macro Workbook. Click Yes to make the shortcut available when you reopen the application.

Tomorrow: The (selective) return of smart quotes in Microsoft Word.