Compartilhar via


WorkbookBase.ActiveChart Property

Definition

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 null.

public:
 property Microsoft::Office::Interop::Excel::Chart ^ ActiveChart { Microsoft::Office::Interop::Excel::Chart ^ get(); };
public Microsoft.Office.Interop.Excel.Chart ActiveChart { get; }
member this.ActiveChart : Microsoft.Office.Interop.Excel.Chart
Public ReadOnly Property ActiveChart As Chart

Property Value

A Chart object that represents the active chart; null 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 void HideActiveChartTitle()
{
    if (this.ActiveChart != null)
    {
        this.ActiveChart.HasTitle = false;
    }
}
Private Sub HideActiveChartTitle()
    If Not (Me.ActiveChart Is Nothing) Then
        Me.ActiveChart.HasTitle = False
    End If
End Sub

Applies to