vba - Adding email sent status to Excel -


i use excel send monthly statements our brokers. there way add column show if each of individual email sent.

some of rows might have invalid email address , way can tell if of them sent going through sent folder.

sub sendemails()      dim answer variant      answer = msgbox("you send statements. proceed?", vbyesno + vbquestion, "alert")      select case answer     case vbyes      msgbox "process may take while finish. not attempt close worksheet or outlook.", vbinformation, "alert"      dim outapp object     dim outmail object     dim sh worksheet     dim cell range     dim filecell range     dim rng range      application         .enableevents = false         .screenupdating = false     end      set sh = sheets("listing")      set outapp = createobject("outlook.application")      each cell in sh.columns("d").cells.specialcells(xlcelltypeconstants)          set rng = sh.cells(cell.row, 1).range("a1:b1")          if cell.value "?*@?*.?*" , _            application.worksheetfunction.counta(rng) > 0             set outmail = outapp.createitem(0)              outmail                 .to = cell.value                 .subject = "statement of account - " & cell.offset(0, 2).value                 .body = cell.offset(0, 1).value                  each filecell in rng.specialcells(xlcelltypeconstants)                     if trim(filecell) <> ""                         if dir(filecell.value) <> ""                             .attachments.add filecell.value                         end if                     end if                 next filecell                  .send  'or use .display             end              set outmail = nothing         end if     next cell      set outapp = nothing     application         .enableevents = true         .screenupdating = true     end      case vbno goto quit:     end select  quit:  end sub 

why not resolve each recipient's email before sending

eg:

    each olrecip in .recipients              olrecip.resolve         if not olrecip.resolve              olmsg.display         end if 

Comments