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:
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.
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.