Importing Data from Excel to Create a Powerpoint - VBA -


what trying important image, or couple, , several lines of data excel create powerpoint slide. found line of code:

sub createpowerpoint()  'first declare variables using     dim newpowerpoint powerpoint.application     dim activeslide powerpoint.slide     dim cht excel.chartobject   'look existing instance     on error resume next     set newpowerpoint = getobject(, "powerpoint.application")     on error goto 0  'let's create new powerpoint     if newpowerpoint nothing         set newpowerpoint = new powerpoint.application     end if 'make presentation in powerpoint     if newpowerpoint.presentations.count = 0         newpowerpoint.presentations.add     end if  'show powerpoint     newpowerpoint.visible = true  'loop through each chart in excel worksheet , paste them powerpoint     each cht in activesheet.chartobjects      'add new slide paste chart         newpowerpoint.activepresentation.slides.add newpowerpoint.activepresentation.slides.count + 1, pplayouttext         newpowerpoint.activewindow.view.gotoslide newpowerpoint.activepresentation.slides.count         set activeslide = newpowerpoint.activepresentation.slides(newpowerpoint.activepresentation.slides.count)      'copy chart , paste powerpoint metafile picture         cht.select         activechart.chartarea.copy         activeslide.shapes.pastespecial(datatype:=pppastemetafilepicture).select      'set title of slide same title of chart         activeslide.shapes(1).textframe.textrange.text = cht.chart.charttitle.text      'adjust positioning of chart on powerpoint slide         newpowerpoint.activewindow.selection.shaperange.left = 15         newpowerpoint.activewindow.selection.shaperange.top = 125          activeslide.shapes(2).width = 200         activeslide.shapes(2).left = 505      next  appactivate ("microsoft powerpoint") set activeslide = nothing set newpowerpoint = nothing  end sub 

i know code works import chart, can't figure out how pull image, , cells text in correct format. maybe i'm making harder needs be, there simpler way?


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -