vba excel to PPT: name excel shape into PPT template with other sh

  • Thread starter Thread starter intoit
  • Start date Start date
I

intoit

Hi,

I've got a macro that copies a shape/chart created in excel and then pastes
the shape into a powerpoint slide that already has a number of other shapes
in it (a template PPT file). I've noticed that when the shape is pasted into
the PPT slide, PPT assigns a semi-arbitrary name to the shape (e.g., "Picture
86"), which requires me to then use that name to apply changes to the shape.
However, it would be more efficient to give the shape a meaningful name that
would not change should the PPT template change in future. Below is the code
I am currently using (it gives an error on the 'With' statement). It must be
as easy as adding .Name = "overall_role_shape" somewhere in the macro, but I
can't figure out where. Thanks for any help.

Dim overall_role_sh As Shape

Set overall_role_sh = Worksheets("Overall_Role").Shapes(1)
overall_role_sh.CopyPicture Appearance:=xlScreen, Format:=xlPicture
PPpres.Slides(2).Shapes.Paste
With PPpres.Slides(2).Shapes("overall_role_shape")
.Left = 14.12
.Top = 116.75
.ZOrder msoSendToBack
End With
 
Back
Top