Hello,VBA code please
All shapes have same sizes, but different orientation - portrait or landscape1. I have 1 shape copied in Clipboard - Clipboard.Shapes(1) /no such collection, only for example/
2. I select many shapes - ActiveSelection.Shapes
I try to replace every Shape in ActiveSelection.Shapes with Clipboard.Shapes(1)
Below is example of requested process
Sub Test_Try()dim mshape as shapeFor each mshape in ActiveSelection.Shapesmshape = Clipboard.Shapes(1)Next
Greetings!
So far I have come up with this code but it is very slow. Please someone suggest improvements!Private Sub CommandButton106_Click()Dim MSHAPE As ShapeFor Each MSHAPE In ActiveSelection.ShapesActiveLayer.PasteWith ActiveShape.PositionX = MSHAPE.PositionX.PositionY = MSHAPE.PositionYEnd WithMSHAPE.DeleteNextEnd Sub
Private Sub CommandButton106_Click()Dim MSHAPE As ShapeActiveDocument.BeginCommandGroup "ReplaceWithClipboard"Optimization = TrueFor Each MSHAPE In ActiveSelection.ShapesActiveLayer.PasteWith ActiveShape.PositionX = MSHAPE.PositionX.PositionY = MSHAPE.PositionYEnd WithMSHAPE.DeleteNextOptimization = False ActiveWindow.RefreshActiveDocument.EndCommandGroupEnd Sub
Code will need tweaked. Works the first time but locks up the application if you copy another shape and try it again.
Thank You! Will try...
I wish Corel made a better effort to support macros across versions.
Tip! don't use paste in loop
It is better in code use Duplicate, than move to destination and delete destination shape. Duplicate is fast function.