Share via


Workbook.ActiveChart Property (2007 System)

Gets a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it is either selected or activated. When no chart is active, this property returns nulla null reference (Nothing in Visual Basic).

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property ActiveChart As Chart
'Usage
Dim instance As Workbook 
Dim value As Chart 

value = instance.ActiveChart
[BrowsableAttribute(false)]
public Chart ActiveChart { get; }
[BrowsableAttribute(false)]
public:
property Chart^ ActiveChart {
    Chart^ get ();
}
public function get ActiveChart () : Chart

Property Value

Type: Chart
A Chart object that represents the active chart; nulla null reference (Nothing in Visual Basic) if no chart is active.

Examples

The following code example uses the ActiveChart property to get the active chart for the current workbook and then makes the title of the chart invisible.

This example is for a document-level customization.

Private Sub HideActiveChartTitle()
    If Not (Me.ActiveChart Is Nothing) Then 
        Me.ActiveChart.HasTitle = False 
    End If 
End Sub
private void HideActiveChartTitle()
{
    if (this.ActiveChart != null)
    {
        this.ActiveChart.HasTitle = false;
    }
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace