I can't see how it works for text because on each iteration you are returning to the original startPosition just before pasting at the selection location. It would make more sense to just remove the two lines that use startPosition.
When it comes to a shape in the clipboard that you are pasting, this can be complicated because Word appears to forget its positioning settings unless you include the paragraph it was anchored to in your clipboard. It is also tricky to just reposition the shape with code since there isn't an obvious way to work out which shape you just pasted. Maybe check the range of the current paragraph to see if it has any shapes anchored - but what happens if there is two or more?
Can you explain the reason you want code to do this? Perhaps there is a better way than using the clipboard and selection objects. If you create the shape with vba it is easy to get a handle for it so that you can position it consistently.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
|