Hi there,
I'm now trying to embed an existing chart in excel into blank powerpoint slide using the example below but what I get is "Embedded OLE Object" written on the slide where the chart is supposed to be. What am I doing wrong? Thanks for your help:
'Instantiate a Presentation object that represents a PPT file
Dim pres As Presentation = New Presentation("C:\\demo.ppt")
'Accessing a slide using its slide position
Dim slide As Slide = pres.GetSlideByPosition(2)
'Reading excel chart from the excel file and save as an array of bytes
Dim fstro As FileStream = New FileStream("C:\\excel1.xls", FileMode.Open, FileAccess.Read)
Dim b() As Byte = New Byte(fstro.Length) {}
fstro.Read(b, 0, CType(fstro.Length, Integer))
'Inserting the excel chart as new OleObjectFrame to a slide
OleObjectFrame oof = slide.Shapes.AddOleObjectFrame(0,0,pres.SlideSize.Width,
pres.SlideSize.Height,"Excel.Sheet.8", b)
'Writing the presentation as a PPT file
pres.Write("C:\\modified.ppt")