Help with fixing my macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

My web site www.gmayor.com

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

My web site www.gmayor.com

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

My web site www.gmayor.com

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