Hello, 

the "chartObj" is not a Chart object it is a shape see 
<win32com.gen_py.Microsoft Excel 14.0 Object Library.Shape ...
Hence this object has no SeriesCollection try the Chart Attribute of the shape 
object.

>>> from win32com.client import Dispatch
>>> Excel = Dispatch("Excel.Application")
>>> WB = Excel.Workbooks.Add()
>>> Shape = WB.Sheets[0].Shapes.AddChart()
>>> Shape.Chart.SeriesCollection
<bound method CDispatch.SeriesCollection of <COMObject <unknown>>>
 

Regards

        Stefan Schukat


-----Original Message-----
From: Python-list [mailto:python-list-bounces+sschukat=dspace...@python.org] On 
Behalf Of Jaydeep Patil
Sent: Thursday, February 13, 2014 12:05 PM
To: python-list@python.org
Subject: AttributeError: '<win32com.gen_py.Microsoft Excel 14.0 Object 
Library.Shape instance at 0x70837752>' object has no attribute 
'SeriesCollection'

I have created chart object. But unable to add series into chart. 
Look at below collection

Code: 

chartObj = addNewChart(newws,-4169,350,600)
>>> print chartObj;
<win32com.gen_py.Microsoft Excel 14.0 Object Library.Shape instance at 
0x70837752>
>>> chartObj.SeriesCollection().NewSeries()

Traceback (most recent call last):
  File "<pyshell#16>", line 1, in <module>
    chartObj.SeriesCollection().NewSeries()
  File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 465, 
in __getattr__
    raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), 
attr))
AttributeError: '<win32com.gen_py.Microsoft Excel 14.0 Object Library.Shape 
instance at 0x70837752>' object has no attribute 'SeriesCollection'
>>> se = chartObj.SeriesCollection().NewSeries()



Regards
Jaydeep Patil
-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to