VBA paste Excel range as picture in ppt EXISTING SHAPE

lukasz_rz

New Member
Joined
Oct 13, 2013
Messages
48
Hi Guys.

I know there is a lot of threads on how to copy paste picture from xls to ppt via VBA. However my problem is a bit different.

I would like not to define the shape location by height, weight and top, left options. I'm thinking of having the object (Content Placeholder) already existing on the ppt slide, where I could paste the selection from the xls as the picture (this could be chart, pivot table or just data range) into. This object is called "CP1".


Code:
Sub test()

Dim myShapeRange As Object, PPApp As Object, PPPres As Object

Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation

Sheets("Slide").Activate
Sheets("Slide").Range("A2:E8").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
[SIZE=4][B]Set myShapeRange = PPPres.Slides(1).Shapes("CP1").Paste[/B][/SIZE]
'that's the place where the problem starts

End Sub

How should I modify the line below to be able to fill the placeholder with the object I just copied?

I would appreciate any help :)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top