Hey Andy. Thanks for replying. I've tried putting a number of things before the save -- including: Application.wait 1000, sleep 1000, doEvents, etc.... When I put this code in a loop and run it 10 times, even with all the waits, sleeps, and doEvents, only 20-40% of the runs work as expected. It's awfully random.
I added a few things, and it's giving me more reliable results now:
Added powerpointApp.visible and activate commands:
Added mySlide.Select to make sure powerpoint has the slide activated:
After making chartdata updates, and before saving, run a "wasteTime" function (see myonlinetraininghub's article on pausing-or-delaying-vba-using-wait-sleep-or-a-loop). Other methods I tried, Application.wait or sleep, didn't give the same results.
When I implemented these changes into my production code, I had to include DoEvents, and calculate the chartdata worksheet, in addition to the wasteTime call:
Thanks for your attention on this issue.
Mike
Bookmarks