officedev - Adding vbnewline into strings VBA -
ok when able solve (with stackoverflow assistance) arranging entries time function, presented new issue.
it no longer followed rules of template have attached it. not huge problem because thought of quick solution not working.
i have added function below, purpose:
split string passed -thesentence- array -thewords()-
find out if string -final- (do while loop adds each word array string 1 @ time) if more 56 length
if -final- more 56 length add vbnewline string before adding next word
change original string -thesentnce- equal created string -final- should have vbnewline in after approx 56 length
.... not working need push in right direction stupid
function chcklen(byval thesentence string) dim thewords() string dim final string dim arraycntr integer dim arrayamount integer dim chcker integer arraycntr = 0 thewords = split(thesentence) arrayamount = ubound(thewords) chcker = 56 while arraycntr <= arrayamount if len(final + thewords(arraycntr)) > chcker final = final + vbnewline final = final + thewords(arraycntr) chcker = chcker + 56 else final = final + " " + thewords(arraycntr) end if arraycntr = arraycntr + 1 loop thesentence = final end function
Comments
Post a Comment