[python-win32] Issue with PythonCOM - Application.Run does not work for Access.Application

Christoph J. Dorner christoph.dorner at gmx.de
Fri Sep 17 03:26:54 EDT 2021


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




More information about the python-win32 mailing list