Macro for Paste Special Unformatted Text

W

WSR

XP SP3
Word 2007

Below is my macro of Paste Special / Picture Enhance Metafile.

Can someone help me modify it for Paste Special / Unformatted Text

Sub PasteSpecialPicture()
'
' PasteSpecialPicture Macro
'
'
Selection.PasteSpecial DataType:=9
End Sub


Thanks for reading and your assistance B^>
 
J

Jay Freedman

XP SP3
Word 2007

Below is my macro of Paste Special / Picture Enhance Metafile.

Can someone help me modify it for Paste Special / Unformatted Text

Sub PasteSpecialPicture()
'
' PasteSpecialPicture Macro
'
'
Selection.PasteSpecial DataType:=9
End Sub


Thanks for reading and your assistance B^>

I think it's more important to point out how to find out these things for
yourself than to solve this particular issue, although we'll get there...

With the cursor in the word PasteSpecial in the VBA editor, press F1 to open the
Help topic for that keyword. In that topic, in the table of parameters, find
DataType. It tells you that this parameter takes a value that's a member of the
WdPasteDataType enumeration, and that word is a hyperlink.

Clicking the link takes you to the topic for WdPasteDataType. There you can find
not only the numeric values but also the names and meanings of the values. In
particular, the value 9 that you already have corresponds to the name
wdPasteEnhancedMetafile. Use the name instead of the number as a form of
internal documentation -- glancing at it tells you what kind of object the
command can paste, without having to look it up.

In the same table, you find that the value wdPasteText (= 2) pastes text.
 
G

Graham Mayor

Or you could call the data type by name

Sub PasteUnfText()
On Error GoTo oops
Selection.PasteSpecial _
DataType:=wdPasteText, _
Placement:=wdInLine
End
oops:
Beep
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top