Articles | Photoshop and Photography blog | about me |e-mail

ProjectWoman

Welcome to Helen Bradley's Microsoft Office and productivity blog. I'm a lifestyle journalist specializing in business and consumer software and here you'll find handy hints for using software such as Microsoft Office 2007 and other office applications. Elsewhere on projectwoman.com you'll find tutorials, articles, how tos and tips on photography and Photoshop CS3. My publishing credits include PC Magazine, Windows XP magazine, CNet, PC User magazine, InformIT and others.

Wednesday, June 18, 2008

Pause a Word macro

Sometimes you need tp pause a macro and, when you do, try the Sleep function.

This involves a call to the Windows API - sounds much more difficult than it is.

In your macro, go to the General Declarations area (the top part of the module) and type this, verbatim:

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

Now, in your routine, when you want to put a pause, type:

sleep n where n is the number of milliseconds to pause for.

So, this macro will beep, pause for 1000 milliseconds and beep again.. it does it twice just in case you missed it the first time:

sub testMyAPIcall()
beep
sleep 1000
beep
sleep 1000
beep
end sub

Easy when you know how!

Labels: ,

Add to Technorati Favorites

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home