![]() |
Macro does not work inside Excel 2007
Got a problem with my 2003 macro inside excel 2007.
When I start that macro I get the error message below (translated from german): "error-No.: 1004 description: application- or objectdefinition error modul: vba project area: AddChart code area: 11" Has anyone an idea? Andreas |
Macro does not work inside Excel 2007
Hi Andreas,
Can you please give the macro code? it is probably something that someone could guess at, but if you give the code then we can be sure to give a better answer. Cheers, Sean. -- (please remember to click yes if replies you receive are helpful to you) "Andreas Wiechmann" wrote: Got a problem with my 2003 macro inside excel 2007. When I start that macro I get the error message below (translated from german): "error-No.: 1004 description: application- or objectdefinition error modul: vba project area: AddChart code area: 11" Has anyone an idea? Andreas |
Macro does not work inside Excel 2007
Hi Sean,
thanks for your answer. In the meantime I've localized the malfunction. Look at this: CodePosFlag = 11 'Darstellungsreihenfolge und Farbe festlegen If Not IsNull(arrPlotOrder) Then For i = 1 To .SeriesCollection.Count ++++++++++ '.ChartGroups(1).SeriesCollection(arrPlotOrder( i - 1)).PlotOrder = i '.ChartGroups(1).SeriesCollection(i).Border.Col orIndex = arrColorIndex(i) Next i End If The instruction with the plus signs I have commented out and things are working again. But we have about one thousand of those files and no one is keen on changing all included macros. What do you think? Regards Andreas "SeanC UK" schrieb im Newsbeitrag ... Hi Andreas, Can you please give the macro code? it is probably something that someone could guess at, but if you give the code then we can be sure to give a better answer. Cheers, Sean. -- (please remember to click yes if replies you receive are helpful to you) "Andreas Wiechmann" wrote: Got a problem with my 2003 macro inside excel 2007. When I start that macro I get the error message below (translated from german): "error-No.: 1004 description: application- or objectdefinition error modul: vba project area: AddChart code area: 11" Has anyone an idea? Andreas |
Macro does not work inside Excel 2007
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. -- (please remember to click yes if replies you receive are helpful to you) "Andreas Wiechmann" wrote: Hi Sean, thanks for your answer. In the meantime I've localized the malfunction. Look at this: CodePosFlag = 11 'Darstellungsreihenfolge und Farbe festlegen If Not IsNull(arrPlotOrder) Then For i = 1 To .SeriesCollection.Count ++++++++++ '.ChartGroups(1).SeriesCollection(arrPlotOrder( i - 1)).PlotOrder = i '.ChartGroups(1).SeriesCollection(i).Border.Col orIndex = arrColorIndex(i) Next i End If The instruction with the plus signs I have commented out and things are working again. But we have about one thousand of those files and no one is keen on changing all included macros. What do you think? Regards Andreas "SeanC UK" schrieb im Newsbeitrag ... Hi Andreas, Can you please give the macro code? it is probably something that someone could guess at, but if you give the code then we can be sure to give a better answer. Cheers, Sean. -- (please remember to click yes if replies you receive are helpful to you) "Andreas Wiechmann" wrote: Got a problem with my 2003 macro inside excel 2007. When I start that macro I get the error message below (translated from german): "error-No.: 1004 description: application- or objectdefinition error modul: vba project area: AddChart code area: 11" Has anyone an idea? Andreas |
All times are GMT +1. The time now is 12:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com