excel vba - Creating a PowerPoint in vba by calling "slide" subroutines -


i creating powerpoint in vba, there lot of slides in it. thinking create macro calls lot of subroutines. within subroutines, actual "slide code" run. however, have created powerpoints of code in same subroutine. took shot @ , below code creates want. question is, public , private variables , use of "dim". bad code if put of in 1 module , use bunch of subroutines? or should separate on modules? prefer not have define each variable such ppslide , pppres, open suggestions. looking ideas on how set up.

public ppapp powerpoint.application public pppres powerpoint.presentation public ppslide powerpoint.slide  sub createpres() dim pptextbox powerpoint.shape dim slidescount long set ppapp = new powerpoint.application ppapp.visible = true ppapp.activate  set pppres = ppapp.presentations.add slidescount = pppres.slides.count set ppslide = pppres.slides.add(slidescount + 1, pplayouttitle) ppslide.shapes(1).textframe.textrange.text = "hello world" ppslide.shapes(2).textframe.textrange.text = date slidescount = slidescount + 1  call slide2(slidescount)  end sub  sub slide2(i integer) 'insert cpr speeds chart , table --- slide 2 set ppslide = pppres.slides.add(i+ 1, pplayoutblank) ppslide.select worksheets("sheet1").activate activesheet.range(cells(1, 4), cells(2, 9)).copy ppslide.shapes.paste.select ppslide.shapes(1).width = _     (pppres.pagesetup.slidewidth / 2) ppslide.shapes(1).left = _     (pppres.pagesetup.slidewidth / 4) ppslide.shapes(1).top = _     4 * (pppres.pagesetup.slideheight / 5)  activesheet.chartobjects("chart1").activate activechart.chartarea.copy ppslide.shapes.paste.select ppslide.shapes(2).height = _     3 * (pppres.pagesetup.slideheight / 5) ppslide.shapes(2).width = _     5 * (pppres.pagesetup.slidewidth / 7) ppslide.shapes(2).left = _     (pppres.pagesetup.slidewidth / 7) ppslide.shapes(2).top = _     (pppres.pagesetup.slideheight / 10)  end sub 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -