On Jul 19, 4:33 pm, Lance Hoffmeyer <[EMAIL PROTECTED]> wrote: > Hey all, > > I have a script that takes numbers from XL and inserts them into an embedded > MSGRAPH dataset in PPT. The problem is that when I reopen the modified > document > that has been saved as a new filename and activate the embedded datasheet the > new numbers that were inserted disappear and the old, original numbers come > back? > > I thought that adding these lines and resetting these variables was supposed > to prevent > this from happening? > > del oGraph > del PWB > del oHEADER > del oVALUE > > Anyone had experience with this and know what I need to do to keep the > embedded datasheet > from reverting back to it's original numbers after modification? > > Thanks in advance, > > Lance > > ################################################################################################################################################################################# > ################################################################################################################################################################################# > # ADD THIS INTO A MODULE IN PPT TO OBTAIN THE PROG ID OF A SLIDE > #Sub test() > #MsgBox "The Slide ID of the current slide is:" & _ > # ActiveWindow.View.Slide.SlideID > #End Sub > ################################################################################################################################################################################# > def attributesbyID(row,base,slideID,spreadsheet): > sh = wb.Worksheets (spreadsheet) > sh.Select() > LIST = xlparams(row, base) > ################ POWERPOINT SECTION ###################### > for shape in WB.Slides.FindBySlideID(slideID).Shapes: > if (shape.Type== 7): > for oXLROW,oXLBASE,oXLLASTCOL,oPPTCELL,oPPTHEADERCELL > in LIST: > oVALUE = sh.Cells(oXLROW,oXLLASTCOL).Value > oHEADER = sh.Cells(base-1,oXLLASTCOL).Value > + " (n=" + str(int(sh.Cells(oXLBASE,oXLLASTCOL).Value)) + ")" > PWB = > WB.Slides.FindBySlideID(slideID).Shapes(shape.Name) > oGraph = PWB.OLEFormat.Object > > oGraph.Application.datasheet.Range(oPPTCELL).Value = oVALUE > > oGraph.Application.datasheet.Range(oPPTHEADERCELL).Value = oHEADER > oGraph.Application.datasheet.Font.Bold=False > del oGraph > del PWB > del oHEADER > del oVALUE > ########################################################### > ################################################################################################################################################################################# > ################################################################################################################################################################################# > ################################################################################################################################################################################# > > def xlparams(row, base): > lastcol=LASTCOL > ############### EXCEL SECTION TO GET NUMBERS ############# > > thelist=((row,base,lastcol,"A13","013"),(row,base,lastcol-1,"A14","014"),(row,base,lastcol-2,"A15","015"),(row,base,lastcol-3,"A16","016"), > > (row+20,base+20,lastcol,"A9","09"),(row+20,base+20,lastcol-1,"A10","010"),(row+20,base+20,lastcol-2,"A11","011"),(row+20,base+20,lastcol-3,"A12","012"), > > (row+40,base+40,lastcol,"A5","05"),(row+40,base+40,lastcol-1,"A6","06" ), > (row+40,base+40,lastcol-2,"A7","07" ), (row+40,base+40,lastcol-3,"A8","08" ), > > (row+60,base+60,lastcol,"A1","01"),(row+60,base+60,lastcol-1,"A2","02" ), > (row+60,base+60,lastcol-2,"A3","03" ), (row+60,base+60,lastcol-3,"A4","04" )) > ########################################################## > return thelist > > ## attribute(ROW NUMBER, BASE ROW NUMBER, SLIDE NUMBER) > attributesbyID(14,12,839,"Attributes(116-144)") # This medication has a > convenient dosing frequency
I've never done this with Python, but it sounds like your inserting a linked table rather than a copy of the dataset as an Excel worksheet. Try doing the insert manually to see which way keeps the data the way you want, then you'll probably gain insight into what you need to do in Python. Mike -- http://mail.python.org/mailman/listinfo/python-list