Hi Andreas,
I have had a look at this and the same thing is happening for me. I am not
entirely sure why at the moment, but I have found that selecting the chart
before attempting this line appears to prevent the problem. I will try to
look into this more and will let you know if I discover the reason. Hopefully
someone else has already addressed this and will comment here. In the
meantime, try adding a line like this and see if it helps:
ActiveSheet.ChartObjects(1).Select
Obviously you will need to use the ChartObject index for your chart,
Once it has been selected the code appears to work. I found this
accidentally when I noticed that the code worked after I opened the workbook
in 2007 and selected the graph properties, then going back to the code and
saw that it worked, even though I hadn't changed any of the graph properties.
But then going back to 2003 caused the problem to occur there. However,
selecting the graph properties in 2003 again prevented the problem, but
reintroduced it to 2007! Therefore I added the select line to the macro and
it appears to run now in both.
As I said, I am not entirely sure why this is happening, and if I get time I
will look into it further. Let me know if this works for you. In my opinion,
if this works then it is a temporary workaround, knowing why this happens is
more important so that the code can be written to always work.
I imagine that you will have to be changing code in your macros, either to
add some lines or to comment out your line.
Either way, if you do find that you need to be changing code in 1000s of
workbooks then I would consider looking into writing something that can
automate this process; a bit more complicated, but in the long run it may
save you time and give you a method to update the workbooks in future, should
you need to do so again.
I hope this helps, and if I do find out why then I shall let you know, and
I'll be watching this post to see if anyone else can give an explanation.
Sean.