Hello Experts,
I am trying to copy and paste shapes using VBA.
I figured out the suitable code after going through couple of forums.
Few lines of my code are as follows:
ActiveSheet.Shapes("Rectangle 203").Copy
ActiveSheet.Range("J56").Paste
Selection.ShapeRange.IncrementTop 4
Selection.ShapeRange.IncrementLeft 4
Selection.ShapeRange.Fill.Visible = msoFalse
The issue that I noticed is....the pasted shape is actually a picture. So it is not treated as Shape, so the Fill statement does not work.
If I use pastespecial command outside VBA, I need to select "Microsoft Office Drawing Object" and then it is pasted as shape. Further processing of shape like Fill is feasible with the shape.
I tried to use Macro Recorder but following line gives an error.
Range("J56").PasteSpecial Format:="Microsoft Office Drawing Object"
Error - Named Argument Not Found
It seems the code using macro recorder is not always a good solution. Please review.
Regards
I am trying to copy and paste shapes using VBA.
I figured out the suitable code after going through couple of forums.
Few lines of my code are as follows:
ActiveSheet.Shapes("Rectangle 203").Copy
ActiveSheet.Range("J56").Paste
Selection.ShapeRange.IncrementTop 4
Selection.ShapeRange.IncrementLeft 4
Selection.ShapeRange.Fill.Visible = msoFalse
The issue that I noticed is....the pasted shape is actually a picture. So it is not treated as Shape, so the Fill statement does not work.
If I use pastespecial command outside VBA, I need to select "Microsoft Office Drawing Object" and then it is pasted as shape. Further processing of shape like Fill is feasible with the shape.
I tried to use Macro Recorder but following line gives an error.
Range("J56").PasteSpecial Format:="Microsoft Office Drawing Object"
Error - Named Argument Not Found
It seems the code using macro recorder is not always a good solution. Please review.
Regards