In article <(E-Mail Removed)>, Ram
Chepyala wrote:
> On Apr 16, 3:17 pm, "Shyam Pillai" <ShyamPil...@Gmail.com> wrote:
> > Add oGraph.Application.Update at the end of the code. to ensure that your
> > changes are saved back into the presentation.
> >
> > Regards,
> > Shyam Pillai
> >
> > Toolbox:http://skp.mvps.org/toolbox
> >
> > "Ram Chepyala" <chepyal...@gmail.com> wrote in message
> >
> > news:(E-Mail Removed)...
> >
> >
> >
> > > Hi
> > > I am updating the datasheet ofembeddedExcel.Chartwith new values
> > > and saving thepowerpoint. When i open the saved PPT i can see the
> > > chart updated, but when i double click on it the values change back to
> > > orginal values and i am losing the updated chart. I am not sure where
> > > i am doing it wrong.I amusingthe below code toeditdatasheet
> > > oPPTFile.Slides(33).Select
> > > Set oPPTShape = oPPTFile.Slides(33).Shapes("Object")
> > > Dim oxl As Excel.Workbook
> > > Dim xchart AsExcel.Chart
> > > Set oxl = oPPTShape.OLEFormat.Object
> > > Set xchart = oxl.Charts(1)
> > > Set xlsheet = oxl.Worksheets(1)
> > > xlsheet.Cells(2, 2) = -6
> > > xlsheet.Cells(3, 2) = -7
> > > xlsheet.Cells(2, 3) = 3
> > > xlsheet.Cells(3, 3) = 8
> > > xlsheet.Cells(2, 4) = -11
> > > xlsheet.Cells(3, 4) = -1
> > > xlsheet.Cells(2, 5) = 8
> > > xlsheet.Cells(3, 5) = 4
> > > Set xlsheet = Nothing
> > > Set xchart = Nothing
> > > Set oxl = Nothing
> > > Normally with the MS graphs i use
> > > Set oGraph = oPPTShape.OLEFormat.Object
> > > oGraph.Application.DataSheet.Range("B1").Value =30
> > > oGraph.update
> > > do we have any sort of update forexcel chartas well? Many thanks in
> > > advance- Hide quoted text -
> >
> > - Show quoted text -
>
> Hi Shyam
> I tried using oxl.update but it gives me an error saying the object
> does not support
I made a few modifications that should be inconsequential but this version
works here; I can't get it to discard changes as you describe above:
Sub SlightModification()
' Set a reference to Excel 11 (I'm using Office 2003)
' Explicitly DIM the shape as a PPT shape
Dim oPPTShape As PowerPoint.Shape
' This shouldn't make any difference
' It gives me a ref to the shape w/o having to create and name
' shapes to duplicate your situation
Set oPPTShape = ActiveWindow.Selection.ShapeRange(1)
Dim oxl As Excel.Workbook
Dim xchart As Excel.Chart
' Explicitly DIM the xlsheet variable
Dim xlsheet As Excel.Worksheet
' the rest is copy/paste from your example, except I've changed the
' data a few times to verify that it's working
' the original data was a match to yours
Set oxl = oPPTShape.OLEFormat.Object
Set xchart = oxl.Charts(1)
Set xlsheet = oxl.Worksheets(1)
xlsheet.Cells(2, 2) = 123
xlsheet.Cells(3, 2) = 234
xlsheet.Cells(2, 3) = 345
xlsheet.Cells(3, 3) = 456
xlsheet.Cells(2, 4) = -11
xlsheet.Cells(3, 4) = -1
xlsheet.Cells(2, 5) = 8
xlsheet.Cells(3, 5) = 4
Set xlsheet = Nothing
Set xchart = Nothing
Set oxl = Nothing
End Sub
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:
www.pptfaq.com
PPTools:
www.pptools.com
================================================