From: EricG on 29 Mar 2010 13:49 I have a fairly simple VBA PowerPoint tool that reads in some data from an Excel worksheet and "charts" it by creating a new PowerPoint slide and then adding drawing objects, text boxes, etc to the slide, creating a simple schedule chart. I usually have an Excel file with two or three worksheets that I want to chart, and run times are generally very quick. However... I recently discovered that if I run this routine through several times in a row during a single run (using the same Excel data for each run and creating exactly the same slide each run), then the run time to create a new slide increases dramatically as the VBA runs. An example is given below, where I ran my routine 40 times, creating 40 new slides (starting with a blank PPT presentation). The final slide took sixteen (16) times longer to draw than the first! I can't tell if this is a VBA issue or a PowerPoint issue. My code is long, ugly and not worth posting here. Do any of you have any ideas that would explain why the per-slide run times increase so much when I run through the loop 40 times versus one or two times? Time to Create Slide (sec): 1.48 2.11 2.34 2.67 2.84 3.11 3.31 3.62 4.03 4.39 4.64 5.01 5.34 5.79 7.04 7.65 8.37 8.70 9.15 11.29 11.39 12.74 13.52 13.85 14.33 15.32 15.75 16.55 17.41 18.24 18.71 19.32 19.84 20.95 21.26 21.71 22.16 22.91 23.62 24.01 Thanks in advance, Eric
From: Matti Vuori on 29 Mar 2010 15:01 =?Utf-8?B?RXJpY0c=?= <EricG(a)discussions.microsoft.com> wrote in news:6778256C-DA9B-485E-B185-C947EEC73EF3(a)microsoft.com: > I can't tell if this is a VBA issue or a PowerPoint issue. My code is > long, ugly and not worth posting here. Do any of you have any ideas > that would explain why the per-slide run times increase so much when I > run through the loop 40 times versus one or two times? The first thing I would check is that the macro closes all Excel and other objects properly so that you don't at the end have 40 hidden instances of Excel running.
From: EricG on 29 Mar 2010 16:38 Thanks for your response. I only have four objects that I "set": Public xlObj as Object = the Excel application. This is set once at the start, then set to Nothing at the end. Public offScreenPres As Presentation = a hidden presentation used to draw all the slides (hidden to speed things up). Public offScreenSlide As Slide = the slide in the offScreenPres that is being drawn to. Once a slide is complete, it is copied to the active (showing) presentation, and offScreenSlide is set to Nothing. Public offScreenShape As Shape = used for any shape that is added to offScreenSlide. This is used many, many times when creating a lot of slides. I tried setting = Nothing after each "set offScreenShape = (something), and that didn't seem to make a difference in the drawing time - it still took longer and longer with each new object added. Also, the memory used becomes extreme according to Task Manager. "Matti Vuori" wrote: > =?Utf-8?B?RXJpY0c=?= <EricG(a)discussions.microsoft.com> wrote in > news:6778256C-DA9B-485E-B185-C947EEC73EF3(a)microsoft.com: > > I can't tell if this is a VBA issue or a PowerPoint issue. My code is > > long, ugly and not worth posting here. Do any of you have any ideas > > that would explain why the per-slide run times increase so much when I > > run through the loop 40 times versus one or two times? > > The first thing I would check is that the macro closes all Excel and other > objects properly so that you don't at the end have 40 hidden instances of > Excel running. > . >
From: Steve Rindsberg on 29 Mar 2010 21:36 In article <34E4FC51-C5E8-4663-AC65-7E26D9406AAC(a)microsoft.com>, EricG wrote: > Thanks for your response. I only have four objects that I "set": > > Public xlObj as Object = the Excel application. This is set once at the > start, then set to Nothing at the end. OK, but what code do you use to set it? Depending on how you do it, you might be inadvertently creating lots of excel instance, as Matti has mentioned. You could put a breakpoint in your code, run it through a few iterations then, while it's stopped at the breakpoint, look at Task Manager to see if there are more instances of EXCEL.EXE than you'd expect in the processes list. Another (outside) possibility: one of my customers ran into a similar-sounding situation. Turns out that the IT department had installed some kind of key logger that turned out to be a PPTSlogger instead. Slowed stuff to a crawl. ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: reversed ""jahbur" on 6 Apr 2010 12:58 Hi Eric I have had the same issue with PP2007 since it came out. Manipulating shapes takes longer and longer each time code runs UNLESS you manipulate something manually on the presentation/slide. This can simply be typing one character into the Notes Pane. If that miraculously speeds up your code, then you've the same issue I have. It is also in PP2010 and I've 'sent a frown' to Microsoft, and posted here... http://social.technet.microsoft.com/Forums/en-US/powerpoint/thread/5761df91-64a2-49e1-9d4c-1dcafaee9c83 ....but with no luck so far. Hope this helps James EricG wrote: > I have a fairly simple VBA PowerPoint tool that reads in some data from an > Excel worksheet and "charts" it by creating a new PowerPoint slide and then > adding drawing objects, text boxes, etc to the slide, creating a simple > schedule chart. I usually have an Excel file with two or three worksheets > that I want to chart, and run times are generally very quick. However... > > I recently discovered that if I run this routine through several times in a > row during a single run (using the same Excel data for each run and creating > exactly the same slide each run), then the run time to create a new slide > increases dramatically as the VBA runs. An example is given below, where I > ran my routine 40 times, creating 40 new slides (starting with a blank PPT > presentation). The final slide took sixteen (16) times longer to draw than > the first! > > I can't tell if this is a VBA issue or a PowerPoint issue. My code is long, > ugly and not worth posting here. Do any of you have any ideas that would > explain why the per-slide run times increase so much when I run through the > loop 40 times versus one or two times? > > Time to Create Slide (sec): > 1.48 > 2.11 > 2.34 > 2.67 > 2.84 > 3.11 > 3.31 > 3.62 > 4.03 > 4.39 > 4.64 > 5.01 > 5.34 > 5.79 > 7.04 > 7.65 > 8.37 > 8.70 > 9.15 > 11.29 > 11.39 > 12.74 > 13.52 > 13.85 > 14.33 > 15.32 > 15.75 > 16.55 > 17.41 > 18.24 > 18.71 > 19.32 > 19.84 > 20.95 > 21.26 > 21.71 > 22.16 > 22.91 > 23.62 > 24.01 > > Thanks in advance, > > Eric >
|
Next
|
Last
Pages: 1 2 Prev: Doesn't anyone care? Next: PowerPoint 2003/2007 Co-existence: Default version to start |