According to the Excel manual, there are three variants of the Copy()
method that applies to Chart objects (and others):
Syntax 1: expression.Copy - copied to clipboard
Syntax 2: expression.Copy(Destination) - copies range
Syntax 3: expression.Copy(Before, After) - duplicates the chart
I can create an Excel application and call other methods, but when I try
to get syntax 1, by calling
chart.Copy(System.Type.missing, System.Type.missing);
it invokes syntax 3 (and duplicates the chart), probably because the
Before and After parameters are optional. How can I tell C# I want to
invoke the syntax without parameters? How can it tell the difference?
Dev Studio 2003 + Office 2000.
Oliver
Oliver Bock - 26 Feb 2006 23:00 GMT
> According to the Excel manual, there are three variants of the Copy()
> method that applies to Chart objects (and others):
>
> Syntax 1: expression.Copy - copied to clipboard
> Syntax 2: expression.Copy(Destination) - copies range
> Syntax 3: expression.Copy(Before, After) - duplicates the chart
It turns out that I'm a victim of ambiguous documentation rather than
Interop. You cannot call syntax 1 from even VBA when applying it to a
Chart object. The correct way to copy a chart and its data is
chart.ChartArea.Copy()
Oliver