How to I PAUSE for x seconds?

M

Mr. Analogy

Hi,

I'm trying to get my VBscript in Publisher 2003 to PAUSE.

there doesn't seem to be an application.wait method.
Where might I declare the SLEEP API call below? (I get an error when
pasting it in the module or form of my project.




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

'Then somewhere in your code:
Sleep 1000 ' =1 second (1000 milliseconds)
 
E

Ed Bennett

Mr. Analogy said:
I'm trying to get my VBscript in Publisher 2003 to PAUSE.

I'm guessing you mean VBA; Publisher doesn't use VBScript.

Is the error you get:

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Constants, fixed-length strings, arrays, user-defined types and Declare
statements not allowed as Public members of object modules
---------------------------
OK Help
---------------------------

?

If so, replace Public with Private.
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds
As Long)

'Then somewhere in your code:
Sleep 1000 ' =1 second (1000 milliseconds)

I just successfully used the following code:

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

Sub jim()
MsgBox "before sleep"
Sleep 5000
MsgBox "after sleep"
End Sub

(Publisher removed the 'Alias "Sleep"')
 
M

Mr. Analogy

I tried pasting it again to check the error message... and it worked this time.

I *swear* I was pasting it in the top of the module's (declarations). Sigh..

Even programmers have operator error occassional.



-Clay
 
M

Mr. Analogy

I realized my error: I was pasting that into the FORM declarations instead
of the module Declarations.

I *thought* I'd checked for that problem.

Solved now.

-Clay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top