I have a performance problem and google doesn’t help me.
This person has the same problem :
http://excel.bigresource.com/Copy-Chart-Print-Very-Slow-1eeSa883.html
When I copy an excel chart with VBA : This is so slooooow.
Dim myChart As ChartObject
For Each myChart In consoPDC.ChartObjects
myChart.Copy
...
Next
Any idea that makes it faster ?
For information the objective is to paste them in powerpoint.
The weird thing is that making it manually isn’t slow at all
Thanks.
Nico.
Because you are making a copy into PowerPoint, i’ll suggest you to try out this code:
found this in MS-Help and here
also found a nice hint here, according to, the following code should be faster
Testet on a small scale demo, excited to hear about big scale results 🙂 would be nice to have some comparision in seconds, when you try this out.
edit: just another thing to watch out for – memory leaks
if you do extensive copy to clipboard you should watch out to clean up afterwards, otherwise you might fill up your memory quite fast 😉 this could also result in weak performance, as many systems might move data to the pagefile, slowing access down.
edit: just if you should be into the last bit of a second and if you have many charts to copy
using
For eachis slower than to iterate through your objects with a neat loop. However, the code does not look that neat like usingfor each, but if any sec/millisec counts one should compare them against each other.I found this in a specialized Book of Micheal Schwimmer, tested it and was suprised. Not sure anymore in which circumstances, but tested it on a bigger scale and confirmed.