powerpoint - Append Text to Shape Without Overwriting Existing Text in VBA -


i have script in vba prints out user selected variables ppt template. in sub:

private sub warninginfo() call dictionary.warninginfo    'sets font warning information text.     activewindow.selection.sliderange.shapes("warningtext1").textframe2.textrange.font      .size = 24     .name = "calibri"     .shadow.visible = true     end  comboboxlist = array(cstr(combobox3))     each ky in comboboxlist     'on error resume next    'if nothing selected in combobox3, nothing , exit sub.     if combobox3 = ""     exit sub     'otherwise, if has selection, insert selected text.     else      activewindow.selection.sliderange.shapes("warningtext1").textframe2.textrange = vbcrlf & dict2.item(ky)(0)      end if   next  set dict2 = nothing  end sub 

it print out dict2.item(ky)(0) within shape warningtext1. variable selected user in gui , pulled dictionary. example of selected , output "no hail expected".

my next sub this:

private sub warninginfo2() call dictionary.windinfo    'sets font warning information text.     activewindow.selection.sliderange.shapes("warningtext1").textframe2.textrange.font      .size = 24     .name = "calibri"     .shadow.visible = true     end  comboboxlist = array(cstr(combobox4))     each ky in comboboxlist     'on error resume next    'if nothing selected in combobox4, nothing , exit sub.     if combobox4 = ""     exit sub     'otherwise, if has selection, insert selected text.     else      activewindow.selection.sliderange.shapes("warningtext1").textframe2.textrange = vbcrlf & dict3.item(ky)(0)      end if   next  set dict3 = nothing  end sub 

it print out dict3.item(ky)(0). however, way second sub set up, overwrite data first sub (since both subs within same userform). need find way change line of code activewindow.selection.sliderange.shapes("warningtext1").textframe2.textrange = vbcrlf & dict3.item(ky)(0) adds text existing text within shape "warningtext1".

any ideas?

thanks!!

activewindow.selection.sliderange.shapes("warningtext1").textframe2.textrange = activewindow.selection.sliderange.shapes("warningtext1").textframe2.textrange & vbcrlf & dict3.item(ky) (0)


Comments