Hey all,

I have a def that I have been using but I realized that sometimes I need a LIST 
with
5 or 6 brands instead of 4 so I want to put LIST outside of the def but I can't 
wrap
my head around a way to get LIST outside the def while still passing the same 4
parameters in the function.  I'm sure there is probably a simple answer but I 
can't
seem to think of it.

Thanks in advance,

Lance


def attributesbyID(row,base,slideID,spreadsheet):
        sh = wb.Worksheets (spreadsheet)
        sh.Select()
        ############### EXCEL SECTION TO GET NUMBERS #############
        
LIST=((row,base,lastcol,"A13","013"),(row,base,lastcol-1,"A14","014"),(row,base,lastcol-2,"A15","015"),(row,base,lastcol-3,"A16","016"),
                      #brand1
              
(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"),#brand2
              
(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" ), 
#brand3
              
(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" )) 
#brand4
        ##########################################################
        ################ POWERPOINT SECTION ######################
        for shape in WB.Slides.FindBySlideID(slideID).Shapes:
                if (shape.Type== 7):
                        for oROW,oBASE,oCOL,oCELL,oHEADERCELL in LIST:
                                oVALUE = sh.Cells(oROW,oCOL).Value
                                oHEADER = sh.Cells(4,oCOL).Value  + " (n="  +  
str(int(sh.Cells(oBASE,oCOL).Value))  + ")"
                                PWB = 
WB.Slides.FindBySlideID(slideID).Shapes(shape.Name)
                                oGraph = PWB.OLEFormat.Object
                                oGraph.Application.datasheet.Range(oCELL).Value 
= oVALUE
                                
oGraph.Application.datasheet.Range(oHEADERCELL).Value = oHEADER
                
       ###########################################################
        del oGraph
attributesbyID(14,12,31,"Attributes") # attr1





Here is what I want:


LIST=((row,base,lastcol,"A13","013"),(row,base,lastcol-1,"A14","014"),(row,base,lastcol-2,"A15","015"),(row,base,lastcol-3,"A16","016"),
                      #brand1
      
(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"),#brand2
      (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" ), 
#brand3
      (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" ), 
#brand4
      (row+80,base+80,lastcol,"A1","01"),(row+80,base+80,lastcol-1,"A2","02" ), 
(row+80,base+80,lastcol-2,"A3","03" ), (row+80,base+80,lastcol-3,"A4","04" )) 
#brand5


def attributesbyID(row,base,slideID,spreadsheet):
        sh = wb.Worksheets (spreadsheet)
        sh.Select()
        ##########################################################
        ################ POWERPOINT SECTION ######################
        for shape in WB.Slides.FindBySlideID(slideID).Shapes:
                if (shape.Type== 7):
                        for oROW,oBASE,oCOL,oCELL,oHEADERCELL in LIST:
                                oVALUE = sh.Cells(oROW,oCOL).Value
                                oHEADER = sh.Cells(4,oCOL).Value  + " (n="  +  
str(int(sh.Cells(oBASE,oCOL).Value))  + ")"
                                PWB = 
WB.Slides.FindBySlideID(slideID).Shapes(shape.Name)
                                oGraph = PWB.OLEFormat.Object
                                oGraph.Application.datasheet.Range(oCELL).Value 
= oVALUE
                                
oGraph.Application.datasheet.Range(oHEADERCELL).Value = oHEADER
                
       ###########################################################
        del oGraph
attributesbyID(14,12,31,"Attributes") # attr1

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to