I have a worksheet with a picture on it named "special". I want to copy this image/shape to another worksheet and then reposition it. The 2nd worksheet exists and the object is named "special"
It seems pretty straightforward. There are plenty of examples on OzGrid. But when I try to paste it I get an error.
Here is the code:
Sub CopyPictureToScorecard(TargetCells As Range) Dim p As Shape Dim p2 As Shape Dim TargetWS As Worksheet Dim ShapesWS As Worksheet Set TargetWS = Sheets("Scorecards") Set ShapesWS = Sheets("Specials") ShapesWS.Shapes("special").Copy TargetWS.Paste 'make sure the picture is properly centered on the scorecard Set p2 = TargetWS.Shapes(TargetWS.Shapes.Count) p2.Width = p.Width p2.Height = p.Height p2.Top = TargetCells.Top + (TargetCells.Height / 2) - (p2.Height / 2) p2.Left = TargetCells.Left + (TargetCells.Width / 2) - (p2.Width / 2) p2.Line.Visible = False End Sub
It failed on the paste. This worked fine on another PC. Might this be a permission problem?