Microsoft KB Archive/283388

= WD2002: Pasted Text Keeps Source Formatting by Default =

Article ID: 283388

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Word 2002 Standard Edition

-



This article was previously published under Q283388



SYMPTOMS
When you paste text, the text is pasted with the formatting of the copied text. In order for the pasted text to acquire the formatting of the destination text, you must select Match Destination Formatting each time that you paste.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To automatically paste the text to match the formatting of the destination text, create the following sample macro, and assign the macro to a shortcut key. Use the shortcut key to paste the copied text into an existing document.

To create the macro, follow these steps:  On the Tools menu, point to Macro, and then click Macros. In the Macros dialog box, type PasteAsDestinationFormat and then click Create.  Create the following sample macro: Sub PasteAsDestinationFormat

Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)

End Sub  On the File menu, click Close and Return to Microsoft Word.

To assign a shortcut key to your macro, follow these steps:
 * 1) On the Tools menu, click Customize.
 * 2) Click Keyboard.
 * 3) Under Categories, click to select Macros.
 * 4) Under Macros, click to select PasteAsDestinationFormat.
 * 5) In the Press new shortcut key box, type the shortcut keys that you want to assign to the macro. For example, press CTRL+F.
 * 6) Click Assign.
 * 7) Click Close to close the Customize Keyboard dialog box.



MORE INFORMATION
When you paste text into a Word document, a Paste Options button appears at the bottom corner of the text as you paste it. This button allows you to specify the formatting of the pasted text. The available choices on the Paste Options button include the following:
 * Keep Source Formatting

When you paste text, the text retains the formatting of the copied text. This is the default option that is selected when you paste text.

For example, if part of the copied text is formatted as Bold, the Bold is retained when you paste the text.
 * Match Destination Formatting

When you paste text and select this option, the text acquires the additional formatting of the text that you paste into.

For example, if the copied text is formatted with an underline, the underline is retained. In addition, the pasted text takes on the formatting of the text that you paste into.
 * Keep Text Only

When you paste text and select this option, the text is pasted as text only and acquires only the formatting of the text that you paste into.

For example, if the copied text is formatted with an underline, the underline is removed. Then the pasted text takes on the formatting of the destination text.
 * Apply Style or Formatting

After you paste copied text and select this option, you can select the style or direct formatting that you want to apply to the pasted text.

For example, if you select the Body Text paragraph style to apply to the pasted text, the text will have a Body Text character style applied to it. You can also apply direct formatting (such as Bold or Italic) to the pasted text.

To turn off the Paste Options button, follow these steps:
 * 1) On the Tools menu, click Options.
 * 2) On the Edit tab, click to clear the Show Paste Options buttons check box.
 * 3) Click OK to close the Options dialog box.

When you paste text, the text will retain the formatting of the copied text.

Additional query words: prb

Keywords: kbmacroexample kbprb KB283388

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.