View Single Post
 
Old 12-11-2023, 04:43 AM
nubuki nubuki is offline Windows 10 Office 2021
Novice
 
Join Date: Dec 2023
Posts: 3
nubuki is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
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.
Thanks a lot!
I moved the set start position into the loop
It works but skips the second page and paste on the rest of the pages
Edit:
I removed it completely like you said.
And it worked.

Copying with the paragraph works as you said

I'm trying to paste a bunch of shapes then fill them with consecutive pictures in a folder
I'm currently inserting the pictures manually.
Is there any method to achieve this through vba?

Regards, Nubuki.

Last edited by nubuki; 12-11-2023 at 07:00 AM.
Reply With Quote