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

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
 
S

Shyam Pillai

Try:

With PPpres.Slides(2).Shapes.Paste(1)
.Name = "overall_role_shape"
.Left = 14.12
.Top = 116.75
.ZOrder msoSendToBack
End With


Regards,
Shyam Pillai

Handout Wizard: http://skp.mvps.org/how
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top