Hi All,
got a bit of a problem with a VBA script i'm trying to run to get a chart to copy across (as an image) into a powerpoint slide. So what it SHOULD do is:
Run
Seek chart name ("Rectangle 1")
Open Powerpoint
Paste image
End
As a basic overview. So far all im getting is Runtime error 9 - subscript out of range. After checking out MSDN.Microsoft it is stating that i have written the parameters outside of boundaries. I honestly cannot see where, is someone able to please see and maybe point out where i have gone wrong?
`Const ppLayoutBlank = 2
Const ppViewSlide = 1
Sub ExportChartstoPowerPoint()
Dim PPApp As Object
Dim chr
Set PPApp = CreateObject("PowerPoint.Application")
PPApp.Presentations.Add
PPApp.ActiveWindow.ViewType = ppViewSlide
For Each chr In Sheets("Rectangle 1").ChartObjects
PPApp.ActivePresentation.Slides.Add PPApp.ActivePresentation.Slides.Count + 1, ppLayoutBlank
PPApp.ActiveWindow.View.GotoSlide PPApp.ActivePresentation.Slides.Count
chr.Select
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
PPApp.ActiveWindow.View.Paste
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
Next chr
PPApp.Visible = True
End Sub`
Bookmarks