Office Interops - Copy excel contents into powerpoint with the ability of editing data RRS feed

  • Question

  • When I try to insert a sample chart into a powerpoint it allows me to edit the data without having to save the source excel sheet in a predefined location. However, when I try to achieve the same via a program, its causing an issue.

    I am able to copy a dynamically generated excel sheet (inclusive of a chart) into power-point with VB.NET using office interops. However, I am unable to embed the chart in power-point so that its "edit data" link is merely an embedded link without having to save the excel sheet in a hard coded path.

    Dim chartObj As office.ChartObject

    Dim charts As office.ChartObjects

    Dim wb As office.Workbook
    Dim ws As office.Worksheet

    Public Sld As Microsoft.Office.Interop.PowerPoint.Slide

    ws = wb.ActiveSheet()

    charts = ws.ChartObjects()

    chartObj = charts.Add(100, 15.0, 500, 400)

    //Do many more things to the ChartObj...


    wb.Close(True, "C:\TEST\File Name.xlsx")


    Now, the question is - how do I remove the hard coded link to the excel file, but still allow users to edit the data in the excel sheet? Is there a mechanism to directly embed charts into power point via office interops?



    • Edited by crystalUSA Wednesday, September 7, 2011 4:55 AM
    • Moved by Paul Zhou Thursday, September 8, 2011 6:15 AM (From:.NET Base Class Library)
    Wednesday, September 7, 2011 3:25 AM


  • Hi,

    I don't think if you remove the link to workbook, your chart will work properly.

    You can remove the link with funktion 'BreakLink' of LinkFormat object.
    CSharp source code:

    foreach (PowerPoint.Shape shape in slide.Shapes)
       if (shape.HasChart == Office.MsoTriState.msoTrue)
          if (shape.Chart.ChartData.IsLinked == true)


    You can set other WorkBook for chart as follow:

    Excel._Workbook oWBook = GetChartWorkBook();//create new workbook

    shape.LinkFormat.SourceFullName = oWBook.FullName;


    My solution for inserting the excel chart in powerpoint you can find hire:

    Regards ,









    • Marked as answer by Bruce Song Monday, September 19, 2011 7:07 AM
    Thursday, September 8, 2011 8:01 AM

All replies