powerpoint - PPT VBA auto-select new textbox? -
i have macro create new textbox parameters, when created, still have go click (and use "enter" keyboard shortcut highlight text , start typing). wondering if there's way have textbox selected run macro, , better, if there's way auto-highlight test text (so there no step between adding box , typing).
code below (copied & modified the spreadsheet guru).
dim sld slide dim shp shape 'error handling if activepresentation.slides.count = 0 msgbox "you not have slides in powerpoint project." exit sub end if set sld = application.activewindow.view.slide 'create shape specified dimensions , slide position set shp = sld.shapes.addtextbox(orientation:=msotextorientationhorizontal, left:=24, top:=65.6, width:=300, height:=100) 'format shape 'no shape border shp.line.visible = msofalse 'shape fill color shp.fill.visible = msofalse 'shape text color shp.textframe.textrange.font.color.rgb = rgb(0, 0, 0) 'text inside shape shp.textframe.textrange.characters.text = "text" 'center align text shp.textframe.textrange.paragraphs.paragraphformat.alignment = ppalignleft 'vertically align text middle shp.textframe2.verticalanchor = msoanchortop 'adjust font size shp.textframe2.textrange.font.size = 12 'adjust font style shp.textframe2.textrange.font.name = "arial"
thank you!
add line @ end:
shp.textframe.textrange.select
Comments
Post a Comment