I'm looking to schedule a call to an MS Access macro. This macro uses a .csv file (that I get daily) to update a SharePoint calendar. Could someone please explain how to schedule a daily call to run this macro (I'm using Access 2003, say EventsCalendar.accdb and macro called Run1) on my Windows 7 machine? I need to automate it to run every morning.
Thanks!
Write a VBScript script that can run the macro straight from Windows. You can do this by first creating an Access application object in your script and then placing this Access object before all calls in the script which need it. For example,
' RunMyMacro.vbs
set accessApp = CreateObject("Access.Application")
accessApp.OpenCurrentDatabase "C:\db\mydb.accdb"
accessApp.DoCmd.RunMacro "MyMacroName"
accessApp.CloseCurrentDatabase
accessApp.Quit
set accessApp = nothing
This script is now runnable from the Windows shell or from the command line:
C:\db>cscript //B //Nologo RunMyMacro.vbs
And so you can schedule it as a Windows scheduled task.