Word 2004 Tip: Creating a direct command for pasting unformatted text
Posted by Pierre Igot in: MacintoshJune 9th, 2004 • 4:56 am
When you copy text from a web page in Safari, what gets copied to the Clipboard is formatted text, i.e. text with typical font formatting such as font face, colour, size, style, etc.
If you then go to Word 2004 and try to paste that text into your Word document, it will paste it as formatted text, with all the formatting, which is usually not appropriate when you want to reuse the text in a Word document, where you typically want to use the formatting of your document’s text instead.
There is a way to avoid this, but it’s rather painful. After you’ve copied text in Safari, you go to Word, you go to the “
” menu, you select the “ ” command and then you choose the “ ” option and press OK. Not exactly convenient.Today, I wanted to add a direct command for this to my “very inconsistent and confusing way Microsoft named these commands, I was unable to find such a command.
” menu. First, I went to Word’s “ ” dialog to see if, by any chance, Word included such a direct command in its extensive list of commands, of which only a subset is part of the default Word user interface. Even taking into account theSo I decided to create a short macro instead. I cannot be bothered with learning the whole VisualBasic macro language, so usually when I want to create a new macro I put Word in macro recording mode and do the various actions that I want it to record as a macro, and then I stop the recording and go to the macro editor to fine-tune the macro.
So in this case, I copied some formatted text from Safari, then started recording a macro in Word, went to the “
” menu, selected “ “, selected the “ ” setting, pasted the text, and stopped the macro recording process.I immediately tried the macro as recorded again, and found that the new macro caused Word to paste formatted text (i.e. the default behaviour for the regular “
” command) rather than unformatted text. So I fired up the macro editor and looked at the macro as recorded by Word:Sub EditPasteUnformatted() Selection.PasteAndFormat (wdPasteDefault) End Sub
I searched for PasteAndFormat
in the Visual Basic help and found the following (cropped):
First of all, wdPasteDefault
is not listed as a possible value for on this help page. Secondly, it’s quite obvious that the value I wanted for this variable is wdFormatPlainText
.
Why didn’t Word record my actions properly and use that value rather than wdPasteDefault
? I have no idea. You’ll have to ask someone at MIcrosoft. But anyway, after changing the value, the macro finally worked as expected, and I was able to add it to my user interface in Word.
I hope this will be of some use to someone else.
June 16th, 2004 at Jun 16, 04 | 1:16 am
Pierre,
Can you please send me the entire Macro? “Paste Unformatted Text” is a key shortcut I desperately miss from Word for Windows (shift-ctrl-V).
June 16th, 2004 at Jun 16, 04 | 3:08 am
The entire macro is:
Add it to your macros. Then you can assign the ctrl-shift-V shortcut to it with the Customize Keyboard dialog.
June 16th, 2004 at Jun 16, 04 | 4:58 am
Mmm, I take that back. It doesn’t seem to work automatically for macros, only for built-in commands. Darn.
June 16th, 2004 at Jun 16, 04 | 4:57 am
Normally, it should do it automatically. Might not work right if you have more than one shortcut assigned to the same command. (Doesn’t know which one to display.)
June 16th, 2004 at Jun 16, 04 | 4:19 am
Yes, I also put it in my menu, just in case I ever forget the keyboard shorcut I’ve assigned to it :).
June 16th, 2004 at Jun 16, 04 | 4:54 am
Can you get Word to diplay the keyboard shortcut in the menu?
June 16th, 2004 at Jun 16, 04 | 3:56 am
Thanks a lot! This has bothered me for a long time.
Your instuctions were great and I even got it into the Menu:
http://unix.dimbert.net/menu.jpg
July 3rd, 2004 at Jul 03, 04 | 7:52 am
I am still using Word X and my experience was a little different. I had to name the macro ?EditPasteUnformatted? (without the quotes) or be stuck with the name ?Macro1.?
I recorded the macro and got this language:
Sub EditPasteUnformatted()
Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False
End Sub
I got some help with the above macro naming convention at:
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=128
where I also found out I could clean up the code a bit by shortening the instructions to:
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
Thanks for starting me off in the right direction. This is a very useful shortcut.
July 7th, 2004 at Jul 07, 04 | 10:06 pm
Nancy: Thanks for the additional information!
November 27th, 2004 at Nov 27, 04 | 5:28 pm
Wow thanks a lot. Really needed this tip. =)
February 9th, 2008 at Feb 09, 08 | 11:38 am
Pierre:
Every time I set up a new Macintosh, this is the first tip I come back to.
Thanks, again!
Best wishes, Clint
February 10th, 2008 at Feb 10, 08 | 11:55 am
Unfortunately, it no longer works with Word 2008. :-/