win32com.client / Trendlines

M

mathieu

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)

Thanks !
 
M

mathieu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
VetaMcRae
Top