really simple question on special paste function

D

Don

hi

i have a very simple macro i use to paste in the contents of the clipboard
and then select it. However i can't get the macro recorder to record the
fact that i'm selecting special paste and choosing unformatted text. What's
the correct code to do this?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/25/2007 by newbe101
'
Selection.WholeStory
Selection.PasteAndFormat (wdPasteDefault)
Selection.WholeStory
End Sub
 
K

Klaus Linke

Hi Don,

Dim iStart As Long
iStart = Selection.Start
Selection.PasteAndFormat (wdFormatPlainText)
Selection.Start = iStart

Regards,
Klaus
 
K

Klaus Linke

Glad it worked! Frankly, I wouldn't know how to achieve that in the user
interface (paste something and have it selected afterwards), so the macro
recorder was not much help here...
And the constants for PasteAndFormat are a bit messy and hard to figure out
from the VBA help (... PasteSpecial would have been another option, but with
the same bad Help).

Regards,
Klaus
 

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