I have searched extesively and do not seem to find an answer. I want to update the data in an existing powerpoint chart. So far I am able to open he presentation,select the page, but I am not able to go past the last line below.
I need to open the datasheet so I can paste the data there. I was able to do it with a new chart but then the dataseheet opens immediately, but I want to use an existign chart as it will have all formatting as required. I will then do this for multiple charts in multiple pages to update a standard presetation for a new group ofcustomers.
Can someone show how would I open the datashet so I can select the right cell and paste my new data (whihc omes from Excel). For many reasons I do not want to pasteexcel charts,I want the daa to reside in PowerPoint. This macro is run from the excel file that has the new data.
Sub test2()
Set rngData = Range("A1:D6")
Set ObjPPT = CreateObject("PowerPoint.Application")
Set ObjPresentation = ObjPPT.Presentations.Open("C:\Documents and Settings\ewnym5s\My Documents\Document_sample.pptx")
Set ObjSlide = ObjPresentation.Slides(1)
Set mychart = ObjSlide.Shapes("Chart 1").Chart
mychart.Select
Set wb = mychart.ChartData
Set ws = wb.Worksheets(1)