I'm attempting to use Excel-VBA to alter ChartData (values) in Powerpoint. The other Excel Workbook is not linked to the ChartData.
Checks: - PowerPoint is open - required Presentation is open - The Chart is on Slide 4
Behavior: - Chart Title Changes - Workbook with ChartData opens - Runtime Error '424' : Objeckt Required - Debugging marks the following line:
Chart.ChartData.Workbook.Worksheets("Tabelle1").Range("B2:B5").Value = 50
Can someone please help me with this?
Sub ModifyChartData()
Dim pptApp As Object
Dim pptPres As Presentation
Set pptApp = GetObject(, "PowerPoint.Application")
Set pptPres = pptApp.ActivePresentation
pptPres.Slides(4).Shapes("Diagramm1").Chart.ChartTitle.Text = "Sales Overview"
pptPres.Slides(4).Shapes("Diagramm1").Chart.ChartData.Activate
Chart.ChartData.Workbook.Worksheets("Tabelle1").Range("B2:B5").Value = 50
Workbooks.Close
End Sub