Tuesday, April 22, 2008

Paste Unformatted Text in Word

If you copy and paste formatted text from different sources into MS Word you may have noticed that it usually will paste it in the original format. This is nice in some cases, but in most cases I find that I want the text to be unformatted (so that it uses the format of the paragraph that I am pasting it into in MS Word). To paste unformatted text all you have to do is go to the Edit Paste Special… menu item and when the dialog appears, select the “Unformatted Text” and click the OK button. While this may be an easy solution it is a complete waste of time in comparison to just typing Control-V. If you do this a lot, you want to be able to paste unformatted text with a single key stroke. Here is how to do this.

In MS Word, go to Tools menu Macro Record New Macro…

In the dialog that appears enter a name for your macro. It can’t contain spaces, and really isn’t important other than it should describe what you are doing with it. In this case, I named my macro, PasteUnformattedText. After entering the macro name, click the Keyboard button. This will open the Customize Keyboard dialog. In the Customize Keyboard window, type the key stroke you want to use to invoke the macro. I set mine to Control-Shift-V. Be sure to click the Assign button, then click the Close button. You will then see a little floating window / palette. Use it to stop recording. At this point you have a macro that is invoked by a key stroke of your choice, but it doesn’t do anything. Now let’s make the macro actually do something. Go to Tools menu Macro Macros… to bring up the Macros dialog. Select your macro, and click the Edit button. This will open the MS Visual Basic code editor. You will see a method that is called whatever you called your macro. If there is any text (besides the ones with an apostrophe before them – these are comments) in the method body, delete it. Your editor should look something like this… Sub PasteUnformattedText()

‘ PasteUnformattedText Macro ‘ Macro recorded 4/22/2008 by usb00528 End Sub

Add one line to this so that it looks like the following… Sub PasteUnformattedText()

‘ PasteUnformattedText Macro ‘ Macro recorded 4/22/2008 by usb00528 Selection.PasteAndFormat (wdFormatPlainText) End Sub

Save and close the window. No give it a test by copying some formatted text, and pasting it using your keystroke. Side Note You don’t have to follow these exact steps to get this done. You can create a new macro, and then later go to Tools Customize… and then select the Macros item from the Categories list. Then select your macro, and click the Keyboard… button to get to the Customize Keyboard dialog you used as described above. The bottom line is, you need to create a macro some how, put the one line of code in it, and assign a keystroke, or a toolbar item if you prefer.

2 comments:

Anonymous said...

thanks.

Anonymous said...

You have changed my life. THANKS!!!