excel - Sending mass emails with attachments using VBA -


i using particularly code in sending mass emails across attachment.

sub mailout()   dim source document, maillist document, tempdoc document dim datarange range dim long, j long dim bstarted boolean dim ooutlookapp outlook.application dim oitem outlook.mailitem dim mysubject string, message string, title string set source = activedocument ' check if outlook running.  if not, start outlook on error resume next set ooutlookapp = getobject(, "outlook.application") if err <> 0 set ooutlookapp = createobject("outlook.application") bstarted = true end if ' open catalog mailmerge document dialogs(wddialogfileopen) .show end set maillist = activedocument ' show input box asking user subject inserted         email messages message = "enter subject used each email message."     ' set prompt. title = " email subject input"    ' set title. ' display message, title mysubject = inputbox(message, title) ' iterate through sections of source document , rows of     catalog mailmerge document, ' extracting information included in each email. j = 1 source.sections.count - 1 set oitem = ooutlookapp.createitem(olmailitem) oitem     .subject = mysubject     .body = source.sections(j).range.text     set datarange = maillist.tables(1).cell(j, 1).range     datarange.end = datarange.end - 1     .to = datarange     = 2 maillist.tables(1).columns.count         set datarange = maillist.tables(1).cell(j, i).range         datarange.end = datarange.end - 1         .attachments.add trim(datarange.text), olbyvalue, 1     next     .send end set oitem = nothing next j maillist.close wddonotsavechanges '  close outlook if started macro. if bstarted ooutlookapp.quit end if msgbox source.sections.count - 1 & " messages have been sent." 'clean set ooutlookapp = nothing  end sub 

i able send attachment formatting of email disappears. eg., bold title becomes normal line, hyperlinks disappears , becomes normal text phrase. able point out went wrong?

thanks! distressed worker.

try using .htmlbody instead of .body

with oitem     .subject = mysubject     .htmlbody = source.sections(j).range.text  'change line     set datarange = maillist.tables(1).cell(j, 1).range     datarange.end = datarange.end - 1     .to = datarange     = 2 maillist.tables(1).columns.count         set datarange = maillist.tables(1).cell(j, i).range         datarange.end = datarange.end - 1         .attachments.add trim(datarange.text), olbyvalue, 1     next     .send end 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -