Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Publisher / Programming / July 2006

Tip: Looking for answers? Try searching our database.

How to I PAUSE for x seconds?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mr. Analogy - 30 Jul 2006 01:28 GMT
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)
Ed Bennett - 30 Jul 2006 11:19 GMT
> 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"')

Signature

Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org

Mr. Analogy - 31 Jul 2006 16:50 GMT
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

> > I'm trying to get my VBscript in Publisher 2003 to PAUSE.
>
[quoted text clipped - 34 lines]
>
> (Publisher removed the 'Alias "Sleep"')
Mr. Analogy - 31 Jul 2006 16:55 GMT
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

> > I'm trying to get my VBscript in Publisher 2003 to PAUSE.
>
[quoted text clipped - 34 lines]
>
> (Publisher removed the 'Alias "Sleep"')

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.