tags:

views:

36

answers:

2

I am making a primitive database in Excel and need a routine to run in the background constantly. I will be able to fill in the actual actions it needs to do, but I don't know how to make something run independent of a key press or some sort of Macro. If someone can give me an example of code that runs independently which I can simply fill with contents, that would be much appreciated.

A: 

I haven't worked with VBA for quite some time now, but you would have to create a thread in VBA, maybe by COM-Threading, but I am not too sure if Excel is threadsafe or if you even can use Threads of some kind in Excel. Another alternative would be a Timer. If it is not implemented in VBA and I don't remember it to be, you would have to create the Timer yourself and react to the Windows Message yourself, if you can do that in VBA.

All in all I think this uses case might be to big for an Excel VBA Macro. If I were you I would consider doing this in a different way.

HalloDu
+2  A: 

Try this http://www.ozgrid.com/Excel/run-macro-on-time.htm

bugtussle
PERFECT! Thank you very much for the help.
Jerome
@Jerome: make sure to accept the answer if it suits your needs, it'll help others with similar questions. And welcome to StackOverflow!
guitarthrower