I have an Excel 2007 workbook with multiple Charts on one worksheet (stacked bar chart and one series as (invisible) line for the totals). Depending on a cell selected by the user, the bar charts should have connectors or not.
For this, I have a small VBa routine trigged by the
Worksheet_Change event that loops over the charts and either sets the connectors using
objChart.SetElement msoElementLineSeriesLine or
objChart.SetElement msoElementLineNone respectively.
This generally works in 90% of the cases. However, sometimes - at some, varying charts,
objChart.SetElement results in a error -2147467259
The specified dimension is not valid for the current chart type. - and breaks the chart, so it looks like this:
The way the fix this after the error occurred is to reopen the file - even if saved after the error occurred. Therefore it seems to be some kind of display problem.