powerpoint - How do I export text from only certain shapes in ppt using VBA? -
i'm trying export text large ppt. have figured out how export text shapes , i'm interested in text.
is there way have if function checks formatting of shape , grabs text if if function true. want select text shapes dashed border. possible?
this code have
sub exporttext() dim opres presentation dim oslides slides dim osld slide 'slide object dim oshp shape 'shape object dim ifile integer 'file handle output ifile = freefile 'get free file number dim pathsep string dim filenum integer #if mac pathsep = ":" #else pathsep = "\" #end if set opres = activepresentation set oslides = opres.slides filenum = freefile 'open output file ' note: errors here if file hasn't been saved open opres.path & pathsep & "alltext.txt" output filenum each osld in oslides 'loop thru each slide each oshp in osld.shapes 'loop thru each shape on slide 'check see if shape has text frame , text if oshp.hastextframe , oshp.textframe.hastext if oshp.type = msoplaceholder select case oshp.placeholderformat.type case = ppplaceholdertitle, ppplaceholdercentertitle print #ifile, "title:" & vbtab & oshp.textframe.textrange case = ppplaceholderbody print #ifile, "body:" & vbtab & oshp.textframe.textrange case = ppplaceholdersubtitle print #ifile, "subtitle:" & vbtab & oshp.textframe.textrange case else print #ifile, "other placeholder:" & vbtab & oshp.textframe.textrange end select else print #ifile, vbtab & oshp.textframe.textrange end if ' msoplaceholder end if ' has text frame/has text next oshp next osld 'close output file close #ifile end sub
here goes solution you. please refer comments inside code further information.
sub partial_solution() '... code here '... loops start here 'this way check dashstyle in interest, 'there lots of different dash styles of line 'then remove debug.print oshp.line.dashstyle 'and way can check style before reading shape 'put result here, 5 msolinedashdot style if oshp.line.dashstyle = 5 '... code here end if '... rest of code here end sub
Comments
Post a Comment