Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default VBA equivalent for WScript.Sleep

Hi,

I need to pause my code periodically. When I use Application.Wait or Timer
function, the processor usage goes to about 50% all the time the sub is
paused, but I need something like WScript.Sleep from VBScript that will pause
execution without affecting processor usage.
Any help is appreciated.



--
urkec
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default VBA equivalent for WScript.Sleep

You can use ontime

Sub Main
Your code here
Application.OnTime Now() + 0.000694444 , "NextPart"
End Sub

Sub NextPart
Rest of code here
End Sub

The 0.000694444 = 1 minute

"urkec" wrote:

Hi,

I need to pause my code periodically. When I use Application.Wait or Timer
function, the processor usage goes to about 50% all the time the sub is
paused, but I need something like WScript.Sleep from VBScript that will pause
execution without affecting processor usage.
Any help is appreciated.



--
urkec

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VBA equivalent for WScript.Sleep

There's a Sleep API, too:

Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Sub testme()
sleep 500 'half second
end sub

urkec wrote:

Hi,

I need to pause my code periodically. When I use Application.Wait or Timer
function, the processor usage goes to about 50% all the time the sub is
paused, but I need something like WScript.Sleep from VBScript that will pause
execution without affecting processor usage.
Any help is appreciated.

--
urkec


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default VBA equivalent for WScript.Sleep

Thanks guys

--
urkec


"Dave Peterson" wrote:

There's a Sleep API, too:

Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Sub testme()
sleep 500 'half second
end sub

urkec wrote:

Hi,

I need to pause my code periodically. When I use Application.Wait or Timer
function, the processor usage goes to about 50% all the time the sub is
paused, but I need something like WScript.Sleep from VBScript that will pause
execution without affecting processor usage.
Any help is appreciated.

--
urkec


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WScript.Shell Dani Excel Programming 4 October 11th 06 04:20 PM
WScript.Echo... VBA Reference? John Keith[_2_] Excel Programming 3 July 8th 06 03:55 PM
using WScript.CreateObject("Wscript.Shell John Keith[_2_] Excel Programming 3 August 30th 05 07:20 PM
Office 2003 not able to run wscript?? Gordon Cashmore[_2_] Excel Programming 2 December 19th 03 05:53 PM
WScript object not found (???) Tom Ogilvy Excel Programming 1 July 10th 03 10:59 PM


All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"