I'm trying to run a macro from an Excel book to automate a chart update in powerpoint. It is going to reseat the source range of a chart I have created. I am doing this to then generate the same chart a number of times, each time with a different source, into separate slides. Both the source Excel and the target powerpoint are always open.
I can't seem to see my mistake here, I am following the documentation but still getting an error.
Sub ThinkcellMacro() 'early bound ppt Dim pptApp As PowerPoint.Application Dim pptPres As PowerPoint.Presentation Set pptApp = GetObject(, "PowerPoint.Application") Set pptPres = pptApp.Presentations("Powerpointpresentation.pptx") 'thinkcell Dim tcaddin As Object Set tcaddin = pptApp.COMAddIns("thinkcell.addin").Object 'Set tcaddin = pptApp.COMAddIns("think-cell") Dim srcWB As Workbook Set srcWB = Workbooks("FileSource.xlsx") Dim srcSHT As Worksheet Set srcSHT = srcWB.Sheets("Sheet") Dim dataRange As Range Set dataRange = srcSHT.Range("A516") Call tcaddin.UpdateChart(pptPres.Slides(1), _ "Waterfall", dataRange, False) End Sub
.UpdateChartcall (like shown in the example in the documentation)