All, I found in the archives an answer I could not find in my inbox. Thanks to Tim Roberts!
So far Idid the instantiation via the database mdb-file and I did not do an EnsureDispatch call on the Access Application object. I tried this in my code and - voila - got an error that makepy could not read the library. I did a manual ensureDispatch for Access.Application from a Python console and got the following: Traceback (most recent call last): File "F:\WinPython\WPy64-3950\python-3.9.5.amd64\lib\site-packages\IPython\core\interactiveshell.py", line 3441, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-ffd005a20a26>", line 1, in <module> app = win32com.client.gencache.EnsureDispatch("Access.Application") File "F:\WinPython\WPy64-3950\python-3.9.5.amd64\lib\site-packages\win32com\client\gencache.py", line 531, in EnsureDispatch mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], bForDemand=bForDemand) File "F:\WinPython\WPy64-3950\python-3.9.5.amd64\lib\site-packages\win32com\client\gencache.py", line 388, in EnsureModule module = GetModuleForTypelib(typelibCLSID, lcid, major, minor) File "F:\WinPython\WPy64-3950\python-3.9.5.amd64\lib\site-packages\win32com\client\gencache.py", line 263, in GetModuleForTypelib AddModuleToCache(typelibCLSID, lcid, major, minor) File "F:\WinPython\WPy64-3950\python-3.9.5.amd64\lib\site-packages\win32com\client\gencache.py", line 559, in AddModuleToCache SetTypelibForAllClsids(mod.CLSIDToClassMap) AttributeError: module 'win32com.gen_py.4AFFC9A0-5F99-101B-AF4E-00AA003F0F07x0x9x0' has no attribute 'CLSIDToClassMap' With Excel it works without error. I am wondering if this might be the issue Tim mentioned earlier regarding Python 64bit and Office / Acccess 32bit ? https://code.activestate.com/lists/python-win32/12574 Best regards Christoph Am 17.09.2021 um 09:26 schrieb Christoph J. Dorner:
Hi there, I need to call Office / VBA applications form a running Python script. While calling VBA from Python using Application.Run works with EXCEL, it does not work with ACCESS. What I do: I link to the Office application via the win32com.client dispatch mechanism as usual and I can see the application object in the Python debugger. If I do an excelapp.Run('xxx") everything is fine. If I do an accessapp.Run('xxx") it throws an error -2147352562 which win32api.FormatMessage states is an issue with the number of parameters. But that cannot be the case as the UDF has no parameter and I do not pass any (additional) parameter. Moreover I simulated this accessapp.Run call from EXCEL in VBA and there it works. Moreover, I did a "passthrough" via EXCEL i. e. called a stub in EXCEL VBA using excelapp.Run in Python which itself calls ACCESS VBA via Application.Run as well. This works for ACCESS VBA code I cannot call directly from Python. It even works to create/pass back VBA object references from ACCESS via EXCEL to Python. I could not find any information ont hat issue and I wonder if this is an issue related to pywin32 / PythonCOM ? I was told this is a support request and not an issue. Happy to learn if anybody else knows this problem and what to do. Thanks in advance Christoph
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32