powerpoint - Make different words in same text box have different font size using VBA -


the title pretty says all, make little more clear, want create text box via vba says "this text should of font size 24, text should of font size 20."

right now, i'm using own function create text box, below. cheers, , help!

sub textbox(textboxtext string)     dim mytextbox shape     activewindow.selection.sliderange         set mytextbox = .shapes.addtextbox _             (orientation:=msotextorientationhorizontal, left:=153, top:=50, _             width:=400, height:=100)         mytextbox.textframe.textrange.text = textboxtext         mytextbox.textframe.textrange.paragraphs.paragraphformat.alignment = ppaligncenter         mytextbox.textframe.textrange.font.bold = msotrue         mytextbox.textframe.textrange.font.name = "arial (headings)"      end end sub 

a richtextbox not needed. answer lies in properties of textrange object within textframe of textbox (what mouthful!). basically, can parse/traverse text within range object and, if make selections based on paragraphs (or sentences, words, characters, etc) can apply different text effects.

sub createtextbox()     dim mytextbox shape     dim textboxtext string     dim texttochange textrange     textboxtext = "this wild text"     activewindow.selection.sliderange         set mytextbox = .shapes.addtextbox(orientation:=msotextorientationhorizontal, _                         left:=153, top:=50, width:=400, height:=100)         mytextbox.textframe.textrange.text = textboxtext         mytextbox.textframe.textrange.paragraphs.paragraphformat.alignment = ppaligncenter         mytextbox.textframe.textrange.font.bold = msotrue         mytextbox.textframe.textrange.font.name = "arial (headings)"          # here's magic happens         set texttochange = mytextbox.textframe.textrange         texttochange.words(3).select         texttochange.words(3).font.size = 42      end end sub 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -