Running a macro automatically is possible. The first thing to say about this procedure is you need to keep Excel running on your machine when you leave the office. Incidentally this procedure can be run at any time of the day or night. I just found it most useful running larger processes over night. I have run processes overnight and they run really well provided you leave your computer on and Excel open. The process will start at the designated time and perform the tasks as if you were there pressing a button. The following is the procedure.
Private Sub Workbook_Open() Application.OnTime TimeValue("02:15:00"), "RunAuto" End Sub Sub RunAuto() Dim Msg As Integer Msg = MsgBox("This Runs!!!", vbOKOnly + vbInformation, "Running Automatically") End Sub
The first part of the procedure generates the action that allows the process to ‘kick off’ as it were. The second part of the process is the macro that ‘does stuff’. In the above case I have kept it simple and the stuff being done is a message box that pops up at 2.15 am that proves the concept. The macro is called RunAuto it could be called anything but notice how “RunAuto” is referred to in the first procedure? This tells Excel what process to run.