Getting a Macro to Work Right

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?
 
G

Graham Mayor

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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Joe McGuire

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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Joe McGuire

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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

You are welcome ... twice.

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

My web site www.gmayor.com

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

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