[python-win32] Is there anyway to pass a VBA object to a Python COM Server and perform operations?
Mark Hammond
skippy.hammond at gmail.com
Wed May 13 02:45:06 CEST 2015
On 13/05/2015 2:32 AM, Diego Vélez Torres wrote:
> Set App_Caller = Application.Caller
> TheGrap = PythonCom.PlaceGraphic(Param1, Param2, App_Caller)
>
> Meanwhile in the COM code I do something like this:
>
> def PlaceGraphic(self, param1, param2, app_caller):
> sheet_obj = app_caller.Worksheet
>
> When I run the code I get the following error message:
>
> 'PyIDispatch' object has no attribute 'Worksheet'
>
> Is there anyway to pass a VBA object to a Python COM Server and perform
> operations?
You should be able to "wrap" this PyIDispatch by doing
win32com.client.Dispatch(app_caller) - Dispatch() lets you pass in
either a string or a PyIDispatch.
HTH,
Mark
More information about the python-win32
mailing list