excel - Array out of bounds, error -


i have following code copies emails inbox, pastes them workbook, transposes info sheet, clears first sheet should loop next email.

it works fine 1 email when there 2 or more emails debug error saying array out of bounds?

any appreciated,

sub emailtext() dim objoutlook object dim mynamespace object dim integer dim j long dim abody() string set objoutlook = getobject(, "outlook.application") set mynamespace = objoutlook.getnamespace("mapi") = 1 mynamespace.getdefaultfolder(6).folders("test").items.count     abody = split(mynamespace.getdefaultfolder(6).folders("test").items(i).body, chr(13) & chr(10))     j = 0 ubound(abody)         sheet1.cells(65000, 1).end(xlup).offset(1, 0).value = abody(j)     next     mynamespace.getdefaultfolder(6).folders("test").items(i).move mynamespace.getdefaultfolder(6).folders("test2")     sheets("sheet2").select         dim nextrow range             sheets("sheet2")                 set nextrow = .cells(.rows.count, 2).end(xlup).offset(1, 0)             end     sheets("sheet1").select     range("e2:e7").select     selection.copy     sheets("sheet2").select     nextrow.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _         :=false, transpose:=true     sheets("sheet1").select     range("a2:a20").select     application.cutcopymode = false     selection.clearcontents     range("b8").select next set objoutlook = nothing set mynamespace = nothing end sub 

many thanks, josh


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -