vba - Find "carriage return" in a mail.body -
i have mails :
hello,
please note did ... @ 16h15
actions done: rebuilding etc
sincerely
mr.
the actions change in every mail , want insert action in excel. problem don't know how "carriage return" (idk if right name, traduction gave me). find in internet vblfchr(10)
"carriage return". tried find beginning :
technicposition= instr(1, .body, "actions done: ") technicaction= mid(.body, technicposition, 14) ' first char action
but can't last char (first "carriage return" technicaction). tried many things : instr(technicposition, .body, vbcrlf)
my question : how sentence begin word "carriage return" (the first comes after beginning word) ?
the carriage return
in email body vbnewline
this how it
sub sample() dim sbody string dim myar dim long ' '~~> rest of code ' sbody = omail.body '~~> testing purpose 'sbody = "hello," & vbnewline & vbnewline 'sbody = sbody & "please note did ... @ 16h15" & vbnewline & vbnewline 'sbody = sbody & "actions done: rebuilding etc" & vbnewline & vbnewline 'sbody = sbody & "sincerely" '~~> split email body on vbnewline , store in array myar = split(sbody, vbnewline) '~~> loop through array = lbound(myar) ubound(myar) '~~> check if line has "actions done:" if instr(1, myar(i), "actions done:") '~~> give "rebuilding etc" '~~> split line on "actions done:" '~~> array. ar(0) have "actions done:" '~~> , ar(1) have looking use '~~> split()(1) directly access item msgbox split(myar(i), "actions done:")(1) exit end if next end sub
edit
Comments
Post a Comment