VBS: Adding trendline to chart

I have a vbscript which is generating the excel file, data and charts
When adding a trendline to a normal line chart (Excel 2007), it adds a tick for "Set Intercept" with a default value of 0.0, how do prevent this from being active? (code attached)
Set oExcel = createobject("Excel.application")
oExcel.Workbooks.open("c:\temp\test.xlsx")
oExcel.visible = true
oExcel.charts.add
oExcel.ActiveChart.Name = oTitle
oExcel.ActiveChart.ChartType = 4
oExcel.ActiveChart.SetSourceData rng, 1

oExcel.ActiveChart.SeriesCollection(1).Select
oExcel.ActiveChart.SeriesCollection(1).Trendlines.Add -4132, , 0, False,False, False

Open in new window

datacomsmtAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jostranderCommented:
on line 10, you have:
oExcel.ActiveChart.SeriesCollection(1).Trendlines.Add -4132, , 0, False,False, False

The last "False" is setting the trendline intercept to value of 0.  If you remove it
oExcel.ActiveChart.SeriesCollection(1).Trendlines.Add -4132, , 0, False,False
or
oExcel.ActiveChart.SeriesCollection(1).Trendlines.Add -4132, , 0, False,False,,False,False,"My Trendline"

Then it should be unchecked.

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.trendlines.add(office.11).aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
datacomsmtAuthor Commented:
That solved it thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.