How to copy a shape from one worksheet to another
I don't handle Shapes much, but I'm doing some automation for a user who's created a bunch of button to navigate from one worksheet to another, and he'd like me to copy a button to a new worksheet when I create it. I can find an example of the button on another worksheet easily enough, and I see various methods for copying it. The Copy method puts a copy of the shape on the clipboard; Pickup and Apply force an existing shape to take on the characteristics of another shape; and Duplicate returns a copy of a shape.
But when it comes to putting the new shape in the new worksheet, I don't see how. All the Add methods I see in the Shapes collection (and there are quite a few) require a handful of extra arguments that specify things about the new shape that I intend to copy from the old shape, including its position on the sheet. The AddShape method, for example, requires arguments for Type, Left, Right, Width and Height. Must I specify some fake values for them and then write over the shape with a Set statement or Apply method? Seems like wasted effort. Does anyone know the better way?
|