Add PowerPoint slide to textbox with CommandButton VBA -
i have command button , text-box in slide master of powerpoint presentation. trying retrieve powerpoint's properties such slideid, slideindex , name of corresponding file , post them text box on click of command button.
at moment have code giving me error:
sub commandbutton1_click() dim index long dim slideid long dim filename string textbox1.text = "slideindex:" & index & "slide id:" & slideid end sub
i want page 1 of power point read slideindex 1 slideid 1 , file name. , slide 2 want two's , on...
thanks in advance!
you can use command button if like; or can use powerpoint shape want draw, assign action setting of run macro , choose macro want run when clicked.
either way, should work:
sub reportstuff() dim osl slide dim osh shape set osl = slideshowwindows(1).view.slide ' test see if shape's there: set osh = isitthere(osl, "my text box") ' if it's not there, add it: if osh nothing set osh = osl.shapes.addtextbox(msotextorientationhorizontal, 100, 100, 200, 50) osh.name = "my text box" end if osh.textframe.textrange .text = "index: " & osl.slideindex & " id: " & osl.slideid & " file: " & activepresentation.fullname end end sub function isitthere(osl slide, sname string) shape dim osh shape each osh in osl.shapes if osh.name = sname set isitthere = osh exit function end if next end function
Comments
Post a Comment