Occasional VBA Method 'Activate' of object 'ChartData' failed
Excel and PowerPoint are created by two different teams of developers.
PowerPoint.Chart is not the same as Excel.Chart
Yes, they look the same and you would think that you have the same level of access to their properties, but that is where you would be wrong. The PowerPoint version is very limited.
Anyway, as far I can tell, you went wrong when you declared
Dim trpChartData As ChartData
Instead of
Dim trpChartData As PowerPoint.ChartData
As Rachel pointed out,
trpChartData is declared without a library qualifier and thus defaults to Excel.ChartData
In addition to that you never cleared trpChartData
with
Set trpChartData = Nothing
I also don't see where you .Quit
the Excel application for the Chart.Workbook
that must have been created. This could explain why there were versions of Excel open in the Task Manager afterwards. Try adding this...
Dim xlApp as Excel.Application''Set xlApp = .Chart.ChartData.Workbook.Application''xlApp.QuitSet xlApp = Nothing