Excel VBA = Display values in a range of cells -
can me this? i'm still new , can't work. trying to:
display data in range of cells in email. found code online me started, text boxes:
sub sample() 'setting excel variables. dim olapp object dim olmailitm object dim icounter integer dim dest variant dim sdest string 'create outlook application , empty email. set olapp = createobject("outlook.application") set olmailitm = olapp.createitem(0) 'using email, add multiple recipients, using list of addresses in column a. olmailitm sdest = "" icounter = 1 worksheetfunction.counta(columns(1)) if sdest = "" sdest = cells(icounter, 1).value else sdest = sdest & ";" & cells(icounter, 1).value end if next icounter 'do additional formatting on bcc , subject lines, add body text spreadsheet, , send. .bcc = sdest .subject = "fyi" .body = activesheet.textboxes(1).text .send end 'clean outlook application. set olmailitm = nothing set olapp = nothing end sub
everything works, except 1 text box, , have lists , whatsits in cells need send too. code i'm trying use is:
.body = activesheet.range("b1:e1").value
instead of:
.body = activesheet.textboxes(1).text
but sends blank email. advice?
double transpose range , use join()
method:
.body = join$(worksheetfunction.transpose(worksheetfunction.transpose(range("b1:e1").value)), vbtab)
this transpose range single dimension array, can joined given delimiter using join()
method.
Comments
Post a Comment