From: Rick on
In Word 2007, when I record a macro that does a regular Paste from the
clipboard, it records it as

Selection.PasteAndFormat(wdPasteDefault)

It also seems to use the same 'wdPasteDefault' type even if I choose
either--

Paste Special | Unformatted Text; or
Paste Special | Unformatted Unicode Text

I'm not sure why it would use the same type for all of these. But the
strange thing is that if I go to the Word Developer Help for the
PasteAndFormat method, and I see what values there are for the
wdRecoveryType, it lists wdPasteDefault as "Not Supported". Thanks
for any thoughts about this.
From: Graham Mayor on
The macro recorder has never been a perfect tool. However in this instance -
Edit > PasteSpecial unformatted text records as

Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False

Unformatted UnicodeText records as

Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine, _
DisplayAsIcon:=False

Data type 20 is wdFormatSurroundingFormattingWithEmphasis

and a simple paste records as

Selection.Paste

in Word 2007 all of which are correct.

Selection.PasteAndFormat (wdPasteDefault)

Uses the default format for the material on the clipboard (that which would
be highlighted if you select the edit > paste special dialog). This varies
with the type of material in question, so does not represent a fixed
definition.

To force a particular type create the macro manually e.g.

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

or with Word 2007, you can set the default paste options to your preferences
in Word Options

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"Rick" <rick0726(a)verizon.net> wrote in message
news:05bbd7d5-2efb-49ba-8bb8-23c5bbeefee6(a)c28g2000vbc.googlegroups.com...
> In Word 2007, when I record a macro that does a regular Paste from the
> clipboard, it records it as
>
> Selection.PasteAndFormat(wdPasteDefault)
>
> It also seems to use the same 'wdPasteDefault' type even if I choose
> either--
>
> Paste Special | Unformatted Text; or
> Paste Special | Unformatted Unicode Text
>
> I'm not sure why it would use the same type for all of these. But the
> strange thing is that if I go to the Word Developer Help for the
> PasteAndFormat method, and I see what values there are for the
> wdRecoveryType, it lists wdPasteDefault as "Not Supported". Thanks
> for any thoughts about this.


From: Rick on
Thanks. In Word 2007, on the clipboard I have a string of text I just
copied from my Word document. When I then record a macro and do any
of these --

- regular Paste
- Paste Special | Unformatted text
- Paste Special | Unformatted Unicode text

the code that I get in the VBA Editor is just --

Selection.PasteAndFormat (wdPasteDefault)

I wonder why I'm getting a different result than you?

On Feb 12, 2:35 am, "Graham Mayor" <gma...(a)REMOVETHISmvps.org> wrote:
> The macro recorder has never been a perfect tool. However in this instance -
> Edit > PasteSpecial unformatted text records as
>
> Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
>         wdInLine, DisplayAsIcon:=False
>
> Unformatted UnicodeText records as
>
> Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine, _
>         DisplayAsIcon:=False
>
> Data type 20 is wdFormatSurroundingFormattingWithEmphasis
>
> and a simple paste records as
>
> Selection.Paste
>
> in Word 2007 all of which are correct.
>
> Selection.PasteAndFormat (wdPasteDefault)
>
> Uses the default format for the material on the clipboard (that which would
> be highlighted if you select the edit > paste special dialog). This varies
> with the type of material in question, so does not represent a fixed
> definition.
>
> To force a particular type create the macro manually e.g.
>
> Sub PasteUnfText()
>     On Error GoTo oops
>     Selection.PasteSpecial _
>     DataType:=wdPasteText, _
>     Placement:=wdInLine
>     End
> oops:
> Beep
> End Sub
>
> or with Word 2007, you can set the default paste options to your preferences
> in Word Options
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor -  Word MVP
>
> My web sitewww.gmayor.com
> Word MVP web sitehttp://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> "Rick" <rick0...(a)verizon.net> wrote in message
>
> news:05bbd7d5-2efb-49ba-8bb8-23c5bbeefee6(a)c28g2000vbc.googlegroups.com...
>
>
>
> > In Word 2007, when I record a macro that does a regular Paste from the
> > clipboard, it records it as
>
> > Selection.PasteAndFormat(wdPasteDefault)
>
> > It also seems to use the same 'wdPasteDefault' type even if I choose
> > either--
>
> > Paste Special | Unformatted Text; or
> > Paste Special | Unformatted Unicode Text
>
> > I'm not sure why it would use the same type for all of these.  But the
> > strange thing is that if I go to the Word Developer Help for the
> > PasteAndFormat method, and I see what values there are for the
> > wdRecoveryType, it lists wdPasteDefault as "Not Supported".  Thanks
> > for any thoughts about this.- Hide quoted text -
>
> - Show quoted text -