[python-win32] type mismatch using win32com.client.GetObject
mhammond at skippinet.com.au
Mon Oct 1 01:32:40 CEST 2007
> So I have a Visual Basic script in Excel which connects via com to
programX and retrieves
> data. The COM function takes 7 required arguments. arg1-6 are set equal to
> determine what data to fetch. arg7 is the variant in which the function
> the fetched data.
> In VB it works like this:
> Private Function functionX(arg1 As Long, arg2 As Integer, arg3 As Long,
> arg4 As Long, arg5 As Boolean, arg6 As Long) As Variant
What makes you think there is an 'arg7' at all then? Aren't we just talking
about a simple return type? If it truly was an arg7, then VB would insist
you treat it as such (ie, by passing it as a true argument and it being
> When I try this in python, I get a type mismatch, for the apparent reason
that arg7 is
> not a variant.
What gives you that impression? Sadly, you haven't provided the rest of
your code so we can see what types you are actually passing.
> So I'm at a loss as to how to force passing arg7 as a variant type.
I'm not at all convinced that 'arg7' exists at all given your description,
so attempting to pass one could well cause such an error. You might be
confused by looking at the C++ implementation of the object, where you do
see it as an 'arg7', but you should ignore that implementation detail - whan
called via IDispatch, the C++ implementation isn't really relevant.
More information about the python-win32