excel - VBA Loop Send Email With Attachment Using IBM Notes? -


i have workbook so:

column g        column w  file1.xls       recipient1@email.com file2.xls       recipient2@email.com 

i want send email using ibm notes each recipient in list in column w.

the same email can sent each recipient, email needs addressed each recipient separately.

in addition, want attach each of corresponding files each email.

i.e. email sent recipient 1 have file 1 attached etc.

here code:

        sub email()  'for tips see: http://www.rondebruin.nl/win/winmail/outlook/tips.htm 'working in office 2000-2016  'variables dim cell range  application.screenupdating = false  dim maildb object dim maildoc object dim body object dim session object  'start session of lotus notes set session = createobject("lotus.notessession")  'this line prompts password of current id noted in notes.ini call session.initialize("perry2011") 'open mail database of lotus notes set maildb = session.getdatabase("", "c:\users\obrienm\appdata\local\ibm\notes\data\as_mobrien.nsf") if not maildb.isopen = true     call maildb.open end if  'loop  'on error goto cleanup each cell in columns("w").cells.specialcells(xlcelltypeconstants)     if cell.value "?*@?*.?*" , _         lcase(cells(cell.row, "g").value) <> ""          'email code         set maildoc = maildb.createdocument           maildoc            .sendto = cell.value            .copyto = ""            .subject = "pasted excel cells " &      'email body text, including marker text replaced excel cells      .body = "text in email body" & vbnewline & vbnewline & _     "**paste excel cells here**" & vbnewline & vbnewline & _     "excel cells shown above"      set notesrichtextitem = .createrichtextitem("body") notesrichtextitem.appendtext ("text in email body") notesrichtextitem.addnewline (2) notesrichtextitem.appendtext ("**paste excel cells here**") notesrichtextitem.addnewline (2) notesrichtextitem.appendtext ("excel cells shown above") notesrichtextitem.addnewline (1) 'and here comes attachment: call notesrichtextitem.embedobject(embed_attachment, "", cell.offset(0, -19).value)            'example save message (optional) in sent items         maildoc.savemessageonsend = true          'send document         'gets mail appear in sent items folder         call maildoc.replaceitemvalue("posteddate", now())         call maildoc.send(true)          'clean object variables - recover memory         'end loop  end          'on error goto 0         set outmail = nothing     end if  next cell  cleanup: set maildb = nothing set maildoc = nothing set body = nothing set session = nothing  application.screenupdating = true end sub 

for reason error on line:

 .sendto = cell.value 

i'm not sure why have verified contents of cell.value , is:

mark.obrien@inbox.co.uk etc. 

which proper email format.

please can show me going wrong?


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -