Share via


ChartData.Workbook Property

Returns the workbook containing the chart data associated with the chart. Read-only Object.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
ReadOnly Property Workbook As Object
    Get
'Usage
Dim instance As ChartData
Dim value As Object

value = instance.Workbook
Object Workbook { get; }

Property Value

Type: System.Object

Remarks

Note

The Activate() method must be called before referencing this property; otherwise, an error occurs.

Examples

This example activates the Microsoft Excel workbook associated with the first chart in the active document. If the Excel workbook has multiple windows, the example activates the first window. The example then copies the contents of cells B1 through B5 and pastes the cell contents into the chart.

With ActivePresentation.Slides(1).Shapes(1)

    If .HasChart Then

        .Chart.ChartData.Activate

        .Chart.ChartData.Workbook. _

            Worksheets("Sheet1").Range("B1:B5").Copy

        .Chart.Paste

    End If

End With

See Also

Reference

ChartData Interface

ChartData Members

Microsoft.Office.Interop.PowerPoint Namespace