A family of Microsoft word processing software products for creating web, email, and print documents.
Use this macro:
Sub PasteUnformatted()
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub
Stefan Blom, Microsoft Word MVP
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
A family of Microsoft word processing software products for creating web, email, and print documents.
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.
Answer accepted by question author
Use this macro:
Sub PasteUnformatted()
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub
Stefan Blom, Microsoft Word MVP
Unfortunately, the recorder isn't that good and this is one of those examples where recording Paste Special, Plain Text keystrokes doesn't work.
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.
Open the Visual Basic Editor in Word (Alt+F11) and press F2.
Terry Farrell
That seems to work very well - Thank you very much.
One last question - is there a place where these commands (eg "PasteUnformatted") are defined?