Excel Pasting Images to Powerpoint

aje35

New Member
Joined
Jun 22, 2010
Messages
47
I have a macro that pastes charts (as images) from Excel in a new PowerPoint slide by slide.

I had to copy the charts as images so they wouldn't have a link to the Excel data anymore.

For some reason when I past the images in to PowerPoint they are obscurely placed on the slide. I need to align these images to the center of each slide.

I found code that does this if your Module is in PowerPoint but all my VBA code is operating out of Excel and for whatever reason it's not working.

To give some background I have up until this point a 65 slide ppt each slide with 1 image on it.

My code works up until this segment:

Code:
Dim osld As Slide
Dim oshp As Shape
Dim x As Integer
Dim y As Integer

With oPP.PageSetup
x = .SlideWidth / 2
y = .SlideHeight / 2
End With

For Each osld In oPP.Slides
[B]For Each oshp In osld.Shapes[/B]

If oshp.Type = msoPicture Then
oshp.Left = x - (oshp.Width / 2)
oshp.Top = y - (oshp.Height / 2)
End If

Next
Next

oPP is what I have set my PowerPoint as, osld is what I have set the slides in that PowerPoint, and where I get an error message is on the bolded line where I am trying to define oshp as the shapes on each slide.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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