vba - Object Required Error after upgrading to Office 2013 -
i have following sub copies chart passed powerpoint slide. it's used build powerpoint deck charts , data in excel spreadsheet. code worked fine in excel 2010. i've been upgraded office 2013 , i'm getting "object required" error on sr.lockaspectratio = msofalse
line.
sub copy_chart(ppres powerpoint.presentation, slidenumber integer, chart chartobject, top single, left single, height single, width single) dim sr powerpoint.shaperange chart.activate activechart.copypicture appearance:=xlscreen, size:=xlscreen, format:=xlpicture set sr = ppres.slides(slidenumber).shapes.paste sr.lockaspectratio = msofalse sr.top = top sr.left = left sr.height = height sr.width = width end sub
apparently past
method must returning array of shaperanges. i'm not sure if how it's been , office 2010 little more forgiving or not. so, correct issue, when referencing sr
i've had sr(sr.count)
. working code below...
sub copy_chart(ppres powerpoint.presentation, slidenumber integer, chart chartobject, top single, left single, height single, width single) dim sr powerpoint.shaperange chart.activate activechart.copypicture appearance:=xlscreen, size:=xlscreen, format:=xlpicture set sr = ppres.slides(slidenumber).shapes.paste sr(sr.count).lockaspectratio = msofalse sr(sr.count).top = top sr(sr.count).left = left sr(sr.count).height = height sr(sr.count).width = width end sub
Comments
Post a Comment