Getting a Macro to Work Right

  • Thread starter Thread starter Joe McGuire
  • Start date Start date
J

Joe McGuire

I recorded a simple macro for using paste Special. With the macro recorded
running I clicked on Edit|Paste Special|Unformatted Text and then ended the
macro recording. But when the macro runs it returns formatted rather than
unformatted text. When I click Edit this seems to be what the macro really
is:

Sub pasteSpec()
'
' pasteSpec Macro
' Macro recorded 1/27/2007 by Joseph McGuire
'
Selection.PasteAndFormat (wdPasteDefault)
End Sub

The object is to end up with a button on my toolbar that I can merely click
and have unformatted text pasted into my Word document. I already have a
button that does this part-way, leaving me to then click "Unformatted Text".
Is there a way to do what I want?
 
Use

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

instead


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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Works great! Thanks!

Graham Mayor said:
Use

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

instead


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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Thanks!

Graham Mayor said:
Use

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

instead


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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
You are welcome ... twice.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top