Help with fixing my macro

C

computerkiller

I created this macro to paste items of the web, but when the paste macro runs
the formating is wrong. How can I correct this? (I want the text to be the
same as on the page, Times New Roman 12 and at the end of the paste.)

Sub PasteSpecial()
'
' PasteSpecial Macro
' Macro recorded 5/21/2007 by Dennis
'
Selection.TypeParagraph
Selection.PasteAndFormat (wdPasteDefault)
End Sub
 
G

Graham Mayor

What you really need is

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


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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

computerkiller

Sorry I do not understand, are you making a joke? Thank you for the reply
though.
 
G

Graham Mayor

The macro posted does what you asked - it inserts text from web pages with
the formatting of the surrounding text - and includes error trapping for
those occasions when you have not selected anything. You can rename it if
you want. If that is not what you wanted, then please clarify. If, for
example, you want to paste the original web format intact, this may not be
possible.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

computerkiller

No I wanted the macro to paste something from the web site, but have the same
formating (text, font size, colour) as the document I pasted it into. I have
to appologies my first remarks came out a little to strong. I ment to just
ask a question. Could you explain what is happening in your macro. Thank you
for your help.
 
G

Graham Mayor

The macro traps errors and bleeps the PC speaker. The most likely error is
having nothing in the clipboard when the macro is run. The macro then pastes
the content of the clipboard as plain unformatted text, so by placing it in
line at the cursor position it adopts the formatting at that position. I
would guess that you used the macro recorder to record much the same thing -
as you have now found the macro recorder does not always record what you
think it will record.

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