excel - Automate trigger from email that has been replied -
i new in vba. ask on how trigger email has been reply.
scenario : have coding below send email recipient (column b) if there "yes" in column c.
for each cell in columns("b").cells.specialcells(xlcelltypeconstants) if cell.value "?*@?*.?*" , _ lcase(cells(cell.row, "c").value) = "yes" set outmail = outapp.createitem(0) on error resume next outmail .to = cell.value .subject = "reminder" .body = "dear " & cells(cell.row, "a").value _ & vbnewline & vbnewline & _ "please contact discuss bringing " & _ "your account date" 'you can add files '.attachments.add ("c:\test.txt") .send 'or use display end
question : how can trigger if recipient has replied email sent earlier? automate trigger excel file on column e remark recipient has replied email. ex, "replied / no reply".
really appreciate since new in vba. thank you.
assuming using microsoft outlook , exchange server.
there 3 extended mapi properties deal message state replied to/forwarded:
pr_icon_index (0x10800003)
pr_last_verb_executed (0x10810003)
pr_last_verb_execution_time (0x10820040)
this msdn article https://msdn.microsoft.com/en-us/library/bb176395(office.12).aspx provides code shows how use these mapi properties:
sub demopropertyaccessorgetproperty() dim propname, header string dim omail object dim opa outlook.propertyaccessor 'get first item in inbox set omail = _ application.session.getdefaultfolder(olfolderinbox).items(1) 'pr_transport_message_headers propname = "http://schemas.microsoft.com/mapi/proptag/0x007d001e" 'obtain instance of propertyaccessor class set opa = omail.propertyaccessor 'call getproperty header = opa.getproperty(propname) debug.print (header) end sub
you want replace 'pr_transport_message_headers ie 0x007d001e in above code , i'm guessing you'll want go through more first mail item...
Comments
Post a Comment