In my paste special macro, I wish that the cursor would appear at the end of
the paste rather than at the beginning. The "placement" variant in the
PasteSpecial method doesn't seem to do the trick. So, for now, I'm inserting
dummy text ("&&") as a work around. I suspect there is a much better way
than what I'm doing. Any thoughts? Here's my work-around.

Sub paste_special()
'
' paste_special Macro
' Macro recorded 7/27/2005 by Todd E. Marlette
'
' INSERT DUMMY TEXT ("&&")
Selection.TypeText Text:="&&"
Selection.MoveLeft Unit:=wdCharacter, Count:=2

' PASTE SPECIAL
Selection.Range.PasteSpecial DataType:=wdPasteText

' SEARCH FOR DUMMY TEXT AND THEN DELETE
' TO PLACE CURSOR AT END OF PASTED TEXT
Selection.Find.ClearFormatting
With Selection.Find
.Text = "&&"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1

End Sub


--
Message posted via http://www.officekb.com

Re: Paste Special Macro -- how to place cursor at end of paste? by Klaus

Klaus
Wed Jul 27 22:18:32 CDT 2005

Hi Todd,

If you use
Selection.PasteSpecial DataType:=wdPasteText
the selection will end up at the end of the pasted text.

I hadn't known about the different behaviour of
Selection.Range.PasteSpecial DataType:=wdPasteText
and had (up to now) remembered the original Selection.Start to jump there
after the paste, if I needed to end up there.

Nice trick ;-)

Regards,
Klaus



"todd m via OfficeKB.com" <forum@OfficeKB.com> schrieb:
>
> In my paste special macro, I wish that the cursor would appear at the
> end of the paste rather than at the beginning. The "placement" variant
> in the PasteSpecial method doesn't seem to do the trick. So, for now,
> I'm inserting dummy text ("&&") as a work around. I suspect there is a
> much better way than what I'm doing. Any thoughts? Here's my
> work-around.
>
> Sub paste_special()
> '
> ' paste_special Macro
> ' Macro recorded 7/27/2005 by Todd E. Marlette
> '
> ' INSERT DUMMY TEXT ("&&")
> Selection.TypeText Text:="&&"
> Selection.MoveLeft Unit:=wdCharacter, Count:=2
>
> ' PASTE SPECIAL
> Selection.Range.PasteSpecial DataType:=wdPasteText
>
> ' SEARCH FOR DUMMY TEXT AND THEN DELETE
> ' TO PLACE CURSOR AT END OF PASTED TEXT
> Selection.Find.ClearFormatting
> With Selection.Find
> .Text = "&&"
> .Replacement.Text = ""
> .Forward = True
> .Wrap = wdFindContinue
> .Format = False
> .MatchCase = False
> .MatchWholeWord = False
> .MatchWildcards = False
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> End With
> Selection.Find.Execute
> Selection.Delete Unit:=wdCharacter, Count:=1
> Selection.MoveLeft Unit:=wdCharacter, Count:=1
>
> End Sub
>
>
> --
> Message posted via http://www.officekb.com



RE: Paste Special Macro -- how to place cursor at end of paste? by ChuckHenrich

ChuckHenrich
Thu Jul 28 08:03:03 CDT 2005

Is there a reason you're using Selection.Range.PasteSpecial instead of
Selection.PasteSpecial? If not, then Selection.PasteSpecial should do what I
gather you're trying to do without the extra code - position the insertion
point at the end of the pasted text instead of the beginning.

--
Chuck Henrich
www.ProductivityApps.com


"todd m via OfficeKB.com" wrote:

>
> In my paste special macro, I wish that the cursor would appear at the end of
> the paste rather than at the beginning. The "placement" variant in the
> PasteSpecial method doesn't seem to do the trick. So, for now, I'm inserting
> dummy text ("&&") as a work around. I suspect there is a much better way
> than what I'm doing. Any thoughts? Here's my work-around.
>
> Sub paste_special()
> '
> ' paste_special Macro
> ' Macro recorded 7/27/2005 by Todd E. Marlette
> '
> ' INSERT DUMMY TEXT ("&&")
> Selection.TypeText Text:="&&"
> Selection.MoveLeft Unit:=wdCharacter, Count:=2
>
> ' PASTE SPECIAL
> Selection.Range.PasteSpecial DataType:=wdPasteText
>
> ' SEARCH FOR DUMMY TEXT AND THEN DELETE
> ' TO PLACE CURSOR AT END OF PASTED TEXT
> Selection.Find.ClearFormatting
> With Selection.Find
> .Text = "&&"
> .Replacement.Text = ""
> .Forward = True
> .Wrap = wdFindContinue
> .Format = False
> .MatchCase = False
> .MatchWholeWord = False
> .MatchWildcards = False
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> End With
> Selection.Find.Execute
> Selection.Delete Unit:=wdCharacter, Count:=1
> Selection.MoveLeft Unit:=wdCharacter, Count:=1
>
> End Sub
>
>
> --
> Message posted via http://www.officekb.com
>

RE: Paste Special Macro -- how to place cursor at end of paste? by ChuckHenrich

ChuckHenrich
Thu Jul 28 08:09:07 CDT 2005

Oops, sorry for the duplicate answer...
--
Chuck Henrich
www.ProductivityApps.com


"todd m via OfficeKB.com" wrote:

>
> In my paste special macro, I wish that the cursor would appear at the end of
> the paste rather than at the beginning. The "placement" variant in the
> PasteSpecial method doesn't seem to do the trick. So, for now, I'm inserting
> dummy text ("&&") as a work around. I suspect there is a much better way
> than what I'm doing. Any thoughts? Here's my work-around.
>
> Sub paste_special()
> '
> ' paste_special Macro
> ' Macro recorded 7/27/2005 by Todd E. Marlette
> '
> ' INSERT DUMMY TEXT ("&&")
> Selection.TypeText Text:="&&"
> Selection.MoveLeft Unit:=wdCharacter, Count:=2
>
> ' PASTE SPECIAL
> Selection.Range.PasteSpecial DataType:=wdPasteText
>
> ' SEARCH FOR DUMMY TEXT AND THEN DELETE
> ' TO PLACE CURSOR AT END OF PASTED TEXT
> Selection.Find.ClearFormatting
> With Selection.Find
> .Text = "&&"
> .Replacement.Text = ""
> .Forward = True
> .Wrap = wdFindContinue
> .Format = False
> .MatchCase = False
> .MatchWholeWord = False
> .MatchWildcards = False
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> End With
> Selection.Find.Execute
> Selection.Delete Unit:=wdCharacter, Count:=1
> Selection.MoveLeft Unit:=wdCharacter, Count:=1
>
> End Sub
>
>
> --
> Message posted via http://www.officekb.com
>