Macro - Paste Unformated Text

G

GR

How do I create a macro to "Paste Unformatted Text" in Word 2002? I note
keystroke recording does not work for this command, just as in WordPerfect.
GR
 
G

Guest

Hi GR-

If recording, you can;

1) Use the mouse to select the command in the menu, or
2) use the keystroke series Alt+e,s,{arrow to command},Enter

Both generate the same code:

Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False

HTH |:>)
 
G

GR

I guess I am near brain-dead. Clearly, I am doing something very wrong
because I get: Selection.PasteAndFormat (wdPasteDefault)

My steps using the mouse are: (1) Select Edit/Paste Special, and (2) from
the resulting menu, select "Unformatted Text" and click "OK." Where am I
going wrong?

What about my copying and pasting the command you quote below into my macro?
GR
 
D

Daiya Mitchell

You should be fine to paste in CyberTaz's code. See here for more detailed
instructions:
What do I do with macros sent to me by other newsgroup readers to help me
out?
I don't know how to install them and put them to use
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

You could also try recording the macro by copying, pasting, then setting the
paste options clipboard icon to "keep text only." I'd be curious to know
whether that works. Even though it should be the same thing, MacWord 2004
has a bug where the Paste Special route generates the wrong code, but the
Paste Options icon generates the right code. Suddenly I bet this bug was
imported from Word 2002.
 
J

Jay Freedman

Hi Daiya and GR,

You're right, recording the Paste Special dialog gives wrong code
while recording the use of the Paste Option button does work correctly
in WinWord. Here are the results:

Sub Macro1()
'
' Macro recorded from Edit > Paste Special
' (doesn't work -- gives source format)
'
Selection.PasteAndFormat (wdPasteDefault)
End Sub

Sub Macro2()
'
' Macro recorded from using Paste Option button
' (works correctly)
'
Selection.PasteAndFormat (wdFormatPlainText)
End Sub

Sub Macro3()
'
' Macro written from scratch
' (works correctly)
'
Selection.PasteSpecial DataType:=wdPasteText
End Sub
 

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