View Single Post
 
Old 12-14-2014, 04:39 PM
Charles Kenyon Charles Kenyon is offline Windows 7 64bit Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,453
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by dherr View Post
Thanks for the fast answer!
The code you show me, I have set this accurate into the module of normal.dotm. But it doesn't work.
I get the error message:
Runtime error. 4248
This order is not available, because no document is open.
What's to do?
Greetings-
Dietrich
Here is code to delay the execution of a macro for a given number of seconds.

Code:
Private Sub HaveABreak(iSeconds As Integer)
'
 ' Macro pauses running of procedure for given number of seconds
' Astrid Zeeland
' https://wordmvp.com/FAQs/MacrosVBA/ShowAllClippitAnimations.htm

 '
Dim lPauseTime As Long
Dim lStart As Long
  lPauseTime = iSeconds
  lStart = Timer 'get current time
  Do While Timer < lStart + lPauseTime
    DoEvents
  Loop
End Sub
Put this into the same module that would hold the AutoExec.

You would call it with HaveABreak (i) where i is the number of seconds you need to wait. Try it with 1. Insert the following into the AutoExec macro before the Show command:

HaveABreak(1)

Last edited by Charles Kenyon; 01-28-2023 at 10:11 AM.
Reply With Quote