how to execute a vba macro every 30 minutes automatically?
I'm w开发者_运维技巧orking on a project to send alert notifications to a mailing list. I've an excel file with a vba macro that permit its updating from a datatbase. I need to execute the macro in the file automatically every 30 minutes without having to open the file. i've been told to write this macro in a separate program, but i don't know how to do it.
Excel VBA DOM has a nice feature called Application.OnTime
. This can schedule a macro to run at any time. To run a Macro every 15 min, just schedule for 15 min in the future on application startup, and then schedule 15 min in the future everytime the macro runs.
From this website: http://www.ozgrid.com/Excel/run-macro-on-time.htm
Example:
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:15:00"), "MyMacro"
End Sub
精彩评论