VBA Macro On Timer style to run code every set number of seconds, i.e. 120 seconds

Posted by FinancialRadDeveloper on Stack Overflow See other posts from Stack Overflow or by FinancialRadDeveloper
Published on 2010-02-23T16:09:32Z Indexed on 2010/04/18 11:23 UTC
Read the original article Hit count: 298

Filed under:
|
|
|
|

I have a need to run a piece of code every 120 seconds. I am looking for an easy way to do this in VBA. I know that it would be possible to get the timer value from the Auto_Open event to prevent having to use a magic number, but I can't quite get how to fire off a timer to get something to run every 120 seconds.

I don't really want to use an infinite loop with a sleep if I can avoid it.


EDIT:

Cross-post based on an answer provided is at: http://stackoverflow.com/questions/2341762/excel-vba-application-ontime-i-think-its-a-bad-idea-to-use-this-thoughts-eit

© Stack Overflow or respective owner

Related posts about vba

Related posts about excel