Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Method to pause VBA?


I must apologize - I'm trying to use this in Access - I was hoping tha
whatver worked for VBA in Excel would work for Access also, but
didn't realize that the Application object for the wait method onl
applied to Excel.

I don't suppose you would happen to know a method for Access?

Thanks

--
tkstoc
-----------------------------------------------------------------------
tkstock's Profile: http://www.excelforum.com/member.php...fo&userid=1444
View this thread: http://www.excelforum.com/showthread.php?threadid=26468

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Method to pause VBA?

tkstock

There's probably a better way, but until you find it you can use this

Dim dtStart As Date

dtStart = Now

Do
Loop Until Now dtStart + TimeSerial(0, 0, 10)


--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"tkstock" wrote in message
...

I must apologize - I'm trying to use this in Access - I was hoping that
whatver worked for VBA in Excel would work for Access also, but I
didn't realize that the Application object for the wait method only
applied to Excel.

I don't suppose you would happen to know a method for Access?

Thanks!


--
tkstock
------------------------------------------------------------------------
tkstock's Profile:

http://www.excelforum.com/member.php...o&userid=14443
View this thread: http://www.excelforum.com/showthread...hreadid=264681



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Method to pause VBA?

"Dick Kusleika" wrote ...

Dim dtStart As Date

dtStart = Now

Do
Loop Until Now dtStart + TimeSerial(0, 0, 10)


You'd want a DoEevnts in there.

There's probably a better way


Yer tiz <g:

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

Jamie.

--
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Method to pause VBA?


"Jamie Collins" wrote in message
om...
"Dick Kusleika" wrote ...

Dim dtStart As Date

dtStart = Now

Do
Loop Until Now dtStart + TimeSerial(0, 0, 10)


You'd want a DoEevnts in there.


Why is that? I see that all the time, but I'm not really trying to do
anything here, so I'm not sure why I need it. Just curious.


There's probably a better way


Yer tiz <g:

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


I need to start blogging these API calls. I guess I'll have to learn a few
first.

Thanks,

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Method to pause VBA?

"Dick Kusleika" wrote in ...

Do
Loop Until Now dtStart + TimeSerial(0, 0, 10)


You'd want a DoEevnts in there.


Why is that? I see that all the time, but I'm not really trying to do
anything here, so I'm not sure why I need it. Just curious.


Ever find yourself waiting for a application to finish a long process,
so you decide to switch to another app while you're waiting but you
can't because that long process is hogging all the machine's
resources? If that app did the equivalent of a DoEvents every now and
again the OS would do a better job of sharing.

That said, on reflection the loop above will be called thousands of
times in ten seconds so calling DoEvents on each iteration is probably
excessive.

I'd consider the Sleep API to be the best solution because for the
duration the application should take no extra resources.

Jamie.

--


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Method to pause VBA?


"Jamie Collins" wrote in message
om...
"Dick Kusleika" wrote in ...

Do
Loop Until Now dtStart + TimeSerial(0, 0, 10)

You'd want a DoEevnts in there.


Why is that? I see that all the time, but I'm not really trying to do
anything here, so I'm not sure why I need it. Just curious.


Ever find yourself waiting for a application to finish a long process,
so you decide to switch to another app while you're waiting but you
can't because that long process is hogging all the machine's
resources? If that app did the equivalent of a DoEvents every now and
again the OS would do a better job of sharing.


Oh, "other" applications. That makes sense.


That said, on reflection the loop above will be called thousands of
times in ten seconds so calling DoEvents on each iteration is probably
excessive.

I'd consider the Sleep API to be the best solution because for the
duration the application should take no extra resources.


Concur. Thanks.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


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
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Please post this thread a complete correct method, method about te Nast Runsome New Users to Excel 0 February 23rd 08 09:42 PM
Method to pause VBA? tkstock Excel Programming 1 September 29th 04 04:38 PM
Pause cogent Excel Programming 3 June 2nd 04 05:54 AM
Pause? Pete Fedrowitz Excel Programming 2 February 13th 04 06:05 PM


All times are GMT +1. The time now is 05:57 PM.

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

About Us

"It's about Microsoft Excel"