Do you have to select the chart in the first place? Select and activate are
often unnecessary.
To 'deselect' a chart, chart.Deselect should work. A limited test from the
VBE confirmed it worked. But, if it doesn't, select a cell.
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article <7F322E0C-F3A5-4633-AE53-(E-Mail Removed)>, sr152
@discussions.microsoft.com says...
> I'm using the excel automation objects (Microsoft.Office.Interop.Excel) for
> Office 2003. Using C#.NET I'm retrieving the list of worksheets in a
> workbook. For each worksheet, if there is a chart on the worksheet there is a
> further processing that is required. However, I need to de-select a selected
> chart area (when the mouse is clicked on the chart area the chart and the
> data columns get selected). I have used:
> foreach(Excel.Chart chart in workbook.Charts)
> {
> try
> {
> chart.Deselect();
> PageSetup(excelApp, chart);
> }
> catch(Exception err)
> {
> PlugInTrace.WriteException(err);
> }
> }
>
> The above piece of code does not undo the selection of the chart area. Any
> help is greatly appreciated.
>
> Thanks.
>