From: Andy on
> I've realized that this works in Excel 2003, however when I try to do it in Excel 2007 it says it is not an appropriate method/property

Are you certain that it's complaining about the Item method? Could you post the error message?

Item is listed as a method in the Excel 2007 Developer's Reference: http://msdn.microsoft.com/en-us/library/bb178917%28v=office.12%29.aspx
From: Mike on
sorry for the double post

This is what I get when I run through Excel 2007

??? No appropriate method, property, or field Border for class Interface.0002086B_0000_0000_C000_000000000046.

Error in ==> XXXXXXXXXXXX
c.SeriesCollection.Item(k+1).Border.ColorIndex = 1;


Thanks~
From: Andy on
"Mike " <mike87y(a)gmail.com> wrote in message <i279c3$sqs$1(a)fred.mathworks.com>...
> sorry for the double post
>
> This is what I get when I run through Excel 2007
>
> ??? No appropriate method, property, or field Border for class Interface.0002086B_0000_0000_C000_000000000046.
>
> Error in ==> XXXXXXXXXXXX
> c.SeriesCollection.Item(k+1).Border.ColorIndex = 1;
>
>
> Thanks~

Well of course. Did you check the link to the developer's reference? The Item method of the SeriesCollection object returns a Series object. If you click the link to the reference page for the Series object, it has no methods or properties called Border. Have you tried, for example, the MarkerForegroundColor property?

Note: I can't test anything, because I don't have access to Excel 2007. But it's often helpful to record a macro in Excel while you perform the action you're trying to accomplish, and then look at the generated VB code.
From: Mike on
Yea...actually most of the methods I find are from VB macros that I try out. However Excel 2007 changed the way they do objects in charts for some stupid reason in a way that you can't even track the changes through a macro on VB~ (I forget where I read this, somewhere from the msdn site)

Also the marker foreground just refers to the markers on the plot itself and not the line that gets drawn through them to connect them to each other :/

I'm just wondering if there's some way to do it still for 2007

(I have to write these programs basically for both 2003 and 2007)
From: Andy on
"Mike " <mike87y(a)gmail.com> wrote in message <i27bt6$e39$1(a)fred.mathworks.com>...
> Yea...actually most of the methods I find are from VB macros that I try out. However Excel 2007 changed the way they do objects in charts for some stupid reason in a way that you can't even track the changes through a macro on VB~ (I forget where I read this, somewhere from the msdn site)
>
> Also the marker foreground just refers to the markers on the plot itself and not the line that gets drawn through them to connect them to each other :/
>
> I'm just wondering if there's some way to do it still for 2007
>
> (I have to write these programs basically for both 2003 and 2007)

As I said, I don't have access to Excel 2007. If there are major differences between them, then you're stuck going through the Developer Reference, using trial and error until you find the relevant object. If you need to handle both Excel 2003 and 2007 and they're very different, then there's not much you can do but write both sets of code and have your MATLAB program choose the correct version at run time.

As for this particular problem, have you looked at the TrendLine object? Something like:

SeriesCollection.Item(9).TrendLines(1).Border.Color

might be what you're looking for.