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, t...@probo.com
Providenza & Boekelheide, Inc.


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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

Reply via email to