Share via

Macro to paste text only

Anonymous
2011-02-25T19:43:13+00:00

I am trying to create a macro in Word 2007 to paste a clipboard selection as text only.  When I created this macro in Word 2003, it worked flawlesly for many years.  However, when I do the same thing in Word 2007, it seems to give me different results.

Is there a place where the Word commands are defined?  I created this macro with the keyboard recording function, but it seems to be buggy.  I am not sure why the paste "Unformmatted Text" would not be the same in all cases.  The following is the Macro.

Sub PasteText()

'

' PasteText Macro

'

'

    Selection.PasteAndFormat (wdPasteDefault)

End Sub

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Stefan Blom 342.3K Reputation points MVP Volunteer Moderator
2011-02-25T20:35:19+00:00

Use this macro:

Sub PasteUnformatted()

On Error Resume Next

Selection.PasteSpecial DataType:=wdPasteText

End Sub


Stefan Blom, Microsoft Word MVP

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-03-03T23:14:30+00:00

    Unfortunately, the recorder isn't that good and this is one of those examples where recording Paste Special, Plain Text keystrokes doesn't work.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-03-03T23:03:04+00:00

    Given your comment about having recorded the original macro, do you realise that you can do the same in Word 2007 [also Excel]? 

    Click on the Office logo,

    Word options,

    Popular tab,

    set Show developer tab in the ribbon. 

    You can then record macros in the way you are used to by going tovthe Developer tab in the Ribbon and, if you want to learn more, look at them in the VB window, select key words then press F1 to see explanations of many commands.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-02-25T22:34:14+00:00

    Open the Visual Basic Editor in Word (Alt+F11) and press F2.


    Terry Farrell

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2011-02-25T21:24:59+00:00

    That seems to work very well - Thank you very much.

    One last question - is there a place where these commands (eg "PasteUnformatted") are defined?

    Was this answer helpful?

    0 comments No comments