PDA

View Full Version : How to schedule an auto run of macros



winxmun
08-26-2016, 04:12 AM
Hi, I have to run a few macros (import data, update data) every morning. Every morning, I will open Access, then click on every command buttons that associates with the macro. May I know is there a way to schedule a daily routine (Monday - Friday) to run the macro automatically. thank you in advance!

jonh
08-29-2016, 10:41 AM
In Access, Macros and VBA are two different things.


A Macro named autoexec will run automatically when you load the file.


Assuming you actually mean Macros and not VBA then create the autoexec macro and select the runmacro command and your macro names in the order you want.


If you mean VBA then you need to move your button click events to public subs in a standard module and create a new public function, ie



public function RunAll()
macro1
macro2
macro3
end function


and in your autoexec macro select runcode and your runall() function.


Then create a scheduled task in Windows.