I'm trying to run a macro from Python. Said macro works fine when executed from Access itself, but I'm trying to do it with the following Python code (handily stolen from How to run a MS Access macro from python):
from win32com.client import Dispatch
access_obj = Dispatch("Access.Application")
access_obj.Visible = False
access_obj.OpenCurrentDatabase("my_database_file.accdb")
access_obj.DoCmd.RunMacro("my_macro")
access_obj.DoCmd.CloseDatabase()
Executing the penultimate line (...RunMacro("my_macro")
) unfortunately results in the following opaque error message:
com_error: (-2147352567, 'Exception occurred.', (0, None, 'You canceled the previous operation.', 'vbaac10.chm', 5738, -2146826287), None)
Any idea what this even means?