excel - Returning a String Array in Outmail.body -


i using known subroutine send warning email outlook whenever condition met.

in routine define string array under name datepassed in store dynamical values , intent return it's content in subject of email.

the problem don't know how handle datepassed return me whole array not first element.

how this?

 sub mail_workbook_outlook_1()        dim outapp object       dim outmail object        set outapp = createobject("outlook.application")       set outmail = outapp.createitem(0)        on error resume next        dim datepassed(100) variant       dim integer       = 6 13            if cells(i, 1) < date              datepassed(i - 6) = cells(i, 2)            end if       next        outmail           .to = "joerge@johnson.com"           .cc = "james@johnson.com"           .bcc = ""           .subject = "unmanaged clients"           .body = datapassed           .attachments.add activeworkbook.fullname           .send       end       on error goto 0        set outmail = nothing       set outapp = nothing   end sub 

try this.

i have added loop run through array , stored string gets assigned .body

 sub mail_workbook_outlook_1()        dim outapp object       dim outmail object        set outapp = createobject("outlook.application")       set outmail = outapp.createitem(0)        on error resume next        dim datepassed(100) variant       dim integer       = 6 13            if cells(i, 1) < date              datepassed(i - 6) = cells(i, 2)            end if       next        '=================================================       'new section        dim datapassedelementreference long       dim datapassedstring string        datapassedstring = ""        'using 100 waht used define array       datapassedelementreference = 1 100             datapassedstring = datapassedstring & datapassed(datapassedelementreference) & " "        next datapassedelementreference       '=================================================        outmail           .to = "joerge@johnson.com"           .cc = "james@johnson.com"           .bcc = ""           .subject = "unmanaged clients"           'note difference here           '.body = datapassed           .body = datapassedstring           .attachments.add activeworkbook.fullname           .send       end       on error goto 0        set outmail = nothing       set outapp = nothing   end sub 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -