Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of


Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF

Put your macro to Sleep

Sometimes you need to make a macro wait for something else to happen.

If you just need to kill time, you can add a loop, but while the loop runs, it eats all available processor cycles. Nothing else can run during the loop.

If you're waiting for some other process on the computer to finish, your loop will prevent the other process from executing, so it'll never finish. You'll be looping for a long, long, time.

You can include a DoEvents statement within the loop to force your code to yield processor cycles to other processes, but your loop will still eat most of the processor's time.

What you really need is a way to put your code to sleep for a bit and set the alarm to wake it up later.


The Windows Sleep API call does exactly this. It puts your macro gently to sleep and wakes it up after a specified time. Your macro eats no processor cycles while it's snoozing. Here's how to induce slumber:

In the Declarations section of your module, include this:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Then in your Sub, use it like so:

Sleep 1000  ' to make your macro "sleep" for one second ( 1000 milliseconds )

See How do I use VBA code in PowerPoint? to learn how to use this example code.

Search terms:sleep,doevents,pause

Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2018 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.
Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Put your macro to Sleep
Last update 07 June, 2011