please can complete code it's driving me insane. scraping data emails access. @ stage can scrape top line access
i can't seem loop array work drop next line, , on until eof
email body looks this, (could 700 lines)
(i'd expect below catch 4 lines , add database.)
n,f,awb,932,50960003,5,markbr1,20160820,9300 n,f,awb,175,04391936,4,markbr1,20160824,0004 n,m,awb,195,04990293,4,jeffbr1,20160824,0004 n,f,awb,245,04415213,4,allanbr1,20160824,0004
code follows (thanks in advance)
option compare database sub getemails() dim olapp outlook.application dim olnamespace outlook.namespace dim k dim j dim x dim xxx dim olfolder outlook.mapifolder dim lngcol long dim olitem object dim whichaccount string dim objns outlook.namespace dim bodytxt string dim bodyrow string dim db dao.database dim rst dao.recordset dim strdata string set olapp = new outlook.application set olnamespace = olapp.getnamespace("mapi") set objns = olapp.getnamespace("mapi") set olfolder = objns.getdefaultfolder(olfolderinbox).folders("markdrafts") set rst = currentdb.openrecordset("select * email 1=0", dbopendynaset) 'table called email, field called emaildata each msg in olfolder.items debug.print msg.body bodytxt = msg.body arrayvariable = split(bodytxt, vbcrlf) 'loop arrayvariable <<< bit don’t work doesn’t drop next line rst.addnew rst!emaildata = arrayvariable(x) rst.update 'loop next rst.close set olapp = nothing set inbox = nothing set inboxitems = nothing set mailobject = nothing set temprst = nothing end sub
i don't know if you're trying use pseudocode because not loop code.
you're not incrementing x @ all
subsitute
'loop arrayvariable <<< bit don’t work doesn’t drop next line rst.addnew rst!emaildata = arrayvariable(x) rst.update 'loop
with actual loop
for x = lbound(arrayvariable) ubound(arrayvariable) rst.addnew rst!emaildata = arrayvariable(x) rst.update next x
Comments
Post a Comment