@CindyMeister: Hey this is the original poster from a different account. Thanks for your answer! However I did try your approach already and it doesn't seem to work for my office installation, nor does it for any other I have tried (I use Office 2013 on a win10 pc myself, I've tried to run the code on machines running Office 2010/2013 on win7/win10). The problem arises whenever you try to run the code you supplied more then once on the same chart. What happens then is you get the following runtime error (probably not an entirely correct translation from German here): the method 'workbook' for the object 'chartdata' has failed runtimeerror -2147467259 (80004005). As I said, this problem only appears after the first run. So your code does run, but only once! That said, I have found a solution that seems almost to easy which works and even runs much faster on my machine. Here it is:
Dim strA As String: strA = "Search"
Dim strb As String: strb = "Replace"
Dim cht As Word.Chart
Dim doc As Word.Document
Dim ils As Word.InlineShape
Set doc = ActiveDocument
Set ils = doc.InlineShapes(1)
Set cht = ils.Chart
If cht.ChartData.Workbook.Sheets(1).Cells(1, 2) = strA Then
cht.ChartData.Workbook.Sheets(1).Cells.Replace What:=strA, Replacement:=strb, LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, ReplaceFormat:=False
Else
cht.ChartData.Workbook.Sheets(1).Cells.Replace What:=strb, Replacement:=strA, LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, ReplaceFormat:=False
End If
cht.ChartData.Workbook.Close
cht.Refresh
Set cht = Nothing
Set ils = Nothing
So as long as you do not assign chartdata.workbook to an Excel.Workbook variable but instead use chartdata.workbook directly you are fine. This is tested on multiple machines all running office 2013 and either win10 or win7. It doesnt work with office 2010 or sooner though. I didn't have the chance to test it on a machine running office 2016 yet unfortunately.
Can you make anything of this?