T
todd m via OfficeKB.com
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
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