Hello
The code below copies Excel charts to a Powerpoint Presentation and was created in Excel 2003 and doesn't work in Excel 2010. Can someone advise why that might be?
Thanks.
The code below copies Excel charts to a Powerpoint Presentation and was created in Excel 2003 and doesn't work in Excel 2010. Can someone advise why that might be?
Thanks.
Code:
Sub CopyCharts_ED()
Dim oppt As New PowerPoint.Application
Dim pptpres As Presentation
Dim pptslide As Slide
Dim ch As Chart
Dim wkb As Workbook
'create new presentation
oppt.Visible = msoTrue
Set pptpres = oppt.Presentations.Add
With pptpres.Slides
'lheight = pptpres.PageSetup.SlideHeight
'lwidth = pptpres.PageSetup.SlideWidth
'place each chart in slide
For Each ch In ActiveWorkbook.Charts
ch.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
Set wkb = ActiveWorkbook
Set pptslide = .Add(.Count + 1, ppLayoutBlank)
pptslide.Shapes.PasteSpecial , , , , , msoFalse
With pptslide.Shapes(1)
.Top = 10
.Left = 10
.LockAspectRatio = msoFalse
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
End With
Next ch
End With
End Sub