[python-win32] Issue with PythonCOM - Application.Run does not work for Access.Application
Tim Roberts
timr at probo.com
Fri Sep 17 12:50:20 EDT 2021
Christoph J. Dorner wrote:
>
> 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.
Curious. Both the Excel "Application.Run" and Access "Application.Run"
methods are defined the same way, with 30 "optional" parameters. Have
you experimented with specifying a dummy parameter to see if that makes
a difference?
Have you tried using "win32com.client.gencache.EnsureDispatch" instead
of simple "Dispatch"? That way, it generates and caches a wrapper
file. It might be possible to peek in the generated file to see if the
wrappers look any different.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3389 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mail.python.org/pipermail/python-win32/attachments/20210917/a40e3df9/attachment.bin>
More information about the python-win32
mailing list