vba - How to identify a wildcard date -


when email specific sender specific subject comes in, vba code things attachment. example of subject line is:

profit , loss summary 06-20-2014 

here code have adapted http://www.jpsoftwaretech.com/outlook-vba/automate-outlook/

dim objns outlook.namespace set objns = getnamespace("mapi") if typeof item outlook.mailitem   dim msg outlook.mailitem   dim twodays variant   set msg = item   if (msg.sendername = "my fav sender") , _    (msg.subject = "profit , loss summary"& " " & format(date, "mm_dd_yyyy")) , _    (msg.attachments.count = 1) 

this recognizes today's date. need code identify date (because reports can come in few days later usual, still want macro run).

how use wildcard date end?

why not ignore date, since don't care is, , string "profit , loss summary " @ beginning of subject?

instr(msg.subject, "profit , loss summary ") = 1 

as in

if msg.sendername = "my fav sender" , _     instr(msg.subject, "profit , loss summary ") = 1 , _     msg.attachments.count = 1 

note filter out replies re: profit , loss summary 06_20_2014. if don't want this, consider instead:

instr(msg.subject, "profit , loss summary ") <> 0 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -