At 09:21 AM 9/5/2005, Arun Tyagi wrote:
>Hi,
>
>I want to know that can we execute MS Access Macro's using python.

# requires Access to be installed
import win32com.client # from https://sourceforge.net/projects/pywin32/
a = win32com.client.Dispatch('access.application.9') # 9 may be different 
depending on access version
# check registry under 
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\access.application for number
# this starts access, as a process, so you don't see it; to see it (not 
required):
a.visible = True
a.OpenCurrentDatabase('c:/.../test.mdb') # provide path to your database
returnValue = a.run("macroname", arg1, arg2, ...)
# if macro is a function returnValue will be whatever function returns; if 
a sub returnValue = None 

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to