HighTechTalks DotNet Forums  

Using Wscript.Sleep in VBA

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss Using Wscript.Sleep in VBA in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Daryl Wilson via .NET 247
 
Posts: n/a

Default Using Wscript.Sleep in VBA - 03-29-2005 , 11:26 PM






I am running a macro via VBA in Excel and I want the macro topause for a time period of less than a second (maybe 200ms) in aloop. I tried using the Application.Wait method, but theminimum wait period is 1 second. I've been driving myself nutstrying to create a WScript object in VBA and use the sleepmethod with no success. Any advice on how to use WScript.Sleepmethod, or any other more appropriate method, would beappreciated.

--------------------------------
From: Daryl Wilson

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>UwbFDbgr/0+W9fNjWnKkvg==</Id>

Reply With Quote
  #2  
Old   
Michael Harris \(MVP\)
 
Posts: n/a

Default Re: Using Wscript.Sleep in VBA - 03-30-2005 , 12:20 AM






Daryl Wilson via .NET 247 wrote:
Quote:
I am running a macro via VBA in Excel and I want the macro to pause
for a time period of less than a second (maybe 200ms) in a loop. I
tried using the Application.Wait method, but the minimum wait period
is 1 second. I've been driving myself nuts trying to create a
WScript object in VBA and use the sleep method with no success. Any
advice on how to use WScript.Sleep method, or any other more
appropriate method, would be appreciated.

The WScript object is built-in to the WSH host EXEs (wscript/cscript.exe)
and is not externally creatable. In VBA you have access to the Win32 API so
you could simply declare and call the Win32 Sleep function. Of course, that
puts the entire thread to sleep so it may not accomplish what you need.


--
Michael Harris
Microsoft MVP Scripting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Please ask follow-up questions via the original newsgroup thread.





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.