You can open Access directly in task scheduler and have this work. You just need to pass the Macro as a parameter. Here's how we did it:
1. Build VBA function to export queries to file, compose email, attache files and send.
2. Build Macro to run VBA function and then close Access. Task scheduler can run macros, but not code directly in a module, thus the need for this step.
3. Set up task scheduler to open access with that macro. Set up task scheduler like you want and then in the actual task you point it to Access and use a switch to tel it what Macro to run.
https://social.msdn.microsoft.com/F...run-a-macro-in-task-scheduler?forum=accessdev