win32com.client / Trendlines
mathieu
mathieu.malaterre at gmail.com
Wed Jan 28 10:43:51 EST 2009
On Jan 28, 4:21 pm, mathieu <mathieu.malate... at gmail.com> wrote:
> Hi there,
>
> I am trying to use win32com.client, but I do not think I fully grasp
> the concept. So far I copied chunk of code from the net to write my
> script. It worked well until I could not find any example on
> Trendlines. According to doc it should be as simple as:
>
> wc.Chart.SeriesCollection(1).Trendlines.Add( type=constants.xlLinear,
> name="Linear Trend")
>
> But I get an error:
>
> Traceback (most recent call last):
> File "addchart.py", line 65, in ?
> wc2.Chart.SeriesCollection(1).Trendlines.Add
> ( type=constants.xlLinear, name="Linear Trend")
> AttributeError: 'function' object has no attribute 'Add'
>
> It looks like Trendlines indeed does not have such member function. Am
> I missing something, do I need to generate something particular (eg.
> using makepy.py)
>
Ok found it.
trend = wc2.Chart.SeriesCollection(1).Trendlines().Add
(Type=constants.xlLinear, Name="Linear Trend")
trend.DisplayRSquared = True
trend.DisplayEquation = True
Trendlines is a function...
Sorry for the noise, win32com really rocks !
-Mathieu
More information about the Python-list
mailing list