Link to home
Start Free TrialLog in
Avatar of arthurh88
arthurh88

asked on

How can I paste a single image in a powerpoint slide many times via a macro?

I'm trying to create a cute slide with an animation that shows an image (i.e. a cartoon virus), "multiplying" dozens of times, all over the slide.
So I created a Macro which calls VBA code on SlideShowNextSlide.  I verify the slide is the right number, and I use this code to copy and paste an object multiple times:
With ActivePresentation
      For Count = 1 To 40
                randomX = Int(850 * Rnd(1)) - 30
                RandomY = Int(500 * Rnd(1)) - 20
                RandomRotation = Int(360 * Rnd(1)) + 1
                ActivePresentation.Slides(9).Shapes(1).Copy
                    Set myrange = ActivePresentation.Slides(9).Shapes.Paste
        myrange.Left = randomX
        myrange.Top = RandomY
        myrange.Rotation = RandomRotation
end with

Open in new window


The code works just fine, however, the images all "appear at once" and I'd like to see them appear 1 at a time, albeit very very fast.   When I use a timer code such as
  Start = Timer
Do While Timer < Start + 0.1
 DoEvents
          Loop
  

Open in new window


it doesn't work well at all.  The results look terrible.  Chunks of items get pasted...then a delay, then more chunks.  Nothing is smooth.  I'd like to have my images pasted with even intervals of a couple of miliseconds.  Is this possible?
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arthurh88
arthurh88

ASKER

Thanks Bill.  I really wanted to do it via code for simplicity, but looks like that isn't the proper way.