Technology

Microsoft Word 2010における「書式なしテキストの貼り付け」ショートカットキー

マイクロソフトのワードを使い続けて、コピーした文字列を「書式なしのテキスト」として貼り付けるオプション設定ができたと思ったら、場合によっては、書式までコピーしたいことがあるので、結局はショートカットキーの違いで、使い分けることが一番楽だという結論に行き当たった。そして、それを実行するための方法を探したら、結局Visual basicのマクロを使わないといけない様子。ショートカットキーを使うなんて、初心者がするわけじゃないので、長く使っている人にも配慮したものを作っていてほしいと思う。

やり方は次の通り。自分のメモのために、参照したブログから転記おきます(一部、修正が必要だった部分は赤字で明記)。

 

Paste Unformatted Text with a Shortcut in Microsoft Word

By Amer Kachmar | Published: March 6, 2011

Many times when you need to paste text from the web, an HTML document, or even other MS Word documents, you may want to just get the text without the formatting and styling that is carried with it. There are several ways to do that, but out of the box, Microsoft Word doesn’t give an easy way, that is with one keyboard shortcut, to do that. The easiest way available with Microsoft Word 2010 is to right click and then click the “A” icon (“Keep Text Only” icon). Now, this is easy but if you need to use that feature many times, it can get annoying and time waster.

The fastest way is to have a keyboard shortcut which does just that. What we are going to do is create a Word Macro and assign a shortcut to it. The following instructions were done using Microsoft Word 2010, but really this Word Macro can be used with almost all Word versions being used today.

Before we create the Macro, if the Developer tab is not visible, do the following to make it show up:

  1. From the menu, click “File” then select “Options”
  2. Select “Customize Ribbon”
  3. On the right side under “Customize the Ribbon” section, check the “Developer” checkbox.
  4. Then click the “OK” button.

CREATING THE PASTE UNFORMATTED TEXT MACRO,

  1. Select the “Developer” tab
  2. Click the “Visual Basic” button.
  3. On the left, in the Project panel, click the plus sign next to “Normal” to expand
  4. Then click the plus sign next to “Modules”  (マクロを使ったことなければ、このModulesは最初から表示されていないので、右クリックして「Insert」から「Module]をクリックするか、メニューの「Insert」で「Module」を選択して表示させる必要がある。)
  5. Double click “NewMacros”  (この段階も2010ではなく、上の設定をした段階で「Module1」というウィンドウが表示されるので、以下の作業に取りかかっていい)
  6. Copy and Paste the following code to the Code window in the Visual Basic editor. (put the mouse cursor at the end of the document before pasting to keep the previously created Macros)

    Sub PasteSpecial()

    Selection.PasteSpecial DataType:=wdPasteText

    End Sub

  7. Click the “save” button. Once you do that a new Macro has been saved with name “PasteSpecial”
  8. Close the Visual Basic window.

ASSIGNING TO THE MACRO A KEYBOARD SHORTCUT,

What we are going to do next is assign a keyboard shortcut to run the macro. We know that to paste text normally, we use ctrl + V keyboard shortcut, so it would be a good idea to assign our macro the alt + V to make it easy for us to remember and differentiate the normal paste from the special paste without formatting.

  1. From the menu, click “File” then select  the “Customize Ribbon” tab
  2. Look for the “Keyboard Shortcuts” label and click the “Customize” button
  3. In the “Categories” section, click anywhere inside it and then press the “M” key so that it gets you to the Macros category.
  4. At the right side and under “Macros” look for “PasteSpecial” and select it.
  5. Then under “Press new shortcut key” label, put you mouse cursor in the field.
  6. Press the keyboard combination alt + V (hold the alt key and then press the “V” key)  (私の好みは、Shift+Ctrl+v)
  7. Then click the “Assign” button.
  8. Then click the “Close” button to close the window, and then “Ok” for the “Word Options” window.

That’s it, now you have the keyboard shortcut alt + V to paste text without style or formatting.

Amer Kachmarさん、ありがとう。