Newbie here.  I  thought my question would have been a common one but I have 
checked the archive for the last year and only found one message even close.

I'm attempting to use a OCX designed to talk with QuickBooks.  I'm using 
win32com for the first time and have discovered an issue that I'm sure others 
have run into.  But researching google etc.  has not helped.

obj = win32com.client.Dispatch("InQB.Invoice.1")
#In the VB code 
#obj.ItemName(0) = 'string' 

#in python I'm trying 
obj.ItemName[0] = 'string'
#error is "Instancemethod object does not support item assignment"

I found and ran makepy.py and here is the code it created dealing with my obj.

# The method ItemName is actually a property, but must be used as a method
to correctly pass the arguments
def ItemName(self, ItemIndex=defaultNamedNotOptArg):
        """Line item property: Reference to the kind of item."""
        # Result is a Unicode object
        return self._oleobj_.InvokeTypes(19, LCID, 2, (8, 0), 
((3,1),),ItemIndex )

As I read the above code it can only return a string not assign anything. I'm 
not sure what "InvokeTypes" does.  And "defaultNamedNotOptArg" does not sound 
good.

Just for information the ItemName[0] is an array (I think not a Vb guy) of 
items on a invoice.  ItemName[0] would refer to the first line item on the 
invoice and ItemName[1] the second and ...

So the question is how can I get around this issue?  I'm sure others need to 
set properties (arrays/list) in com objects.

Thanks in advance,

Johnf
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to