excel - Reference cell in another workbook as email address in .To field -


i'm trying reference cell a1 in workbook, in sheet, set "to" field in email. here code:

dim outapp object dim outmail object  set outapp = createobject("outlook.application") set outmail = outapp.createitem(0)  addresses = workbooks("test.xlsx").sheets("sheet2").range("a1").value  on error resume next outmail  .to = addresses .cc = "" .bcc = "" .subject = "confirm " & format(date, "mm.dd.yy") .body = "please see attached confirm.  thanks," .attachments.add activeworkbook.fullname .display end on error goto 0  set outmail = nothing set outapp = nothing 

when execute macro, "to" field in email has nothing in it. cell referencing has value in it. have suggestions?

try moving display beginning. so...

with outmail      .display 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -