How to transfer tables in Outlook 2010 emails to Excel 2010 -
i have around 2000 emails sent me in zip file. emails have following structure:
http://social.msdn.microsoft.com/forums/getfile/429285
all mails have same subject. can seen screenshot, each mail has multiple tables. these tables have varying number of rows each mail. task of these multiple tables contained in 2000 mails excel form graphs , charts. can please me how go through automation. tried few solutions available found nothing transfer tables within outlook emails excel. have deadline task , prompt appreciated. in advance!
this worked me.
add reference microsoft html object library
in vba project (under tools >> references in vb editor)
assumes outlook open, , mails stored in path msg_path
.
sub tester() const msg_path string = "c:\_stuff\test\mails\" dim ol, m, t, r, c dim doc new mshtml.htmldocument dim rng range, rw object dim f set ol = getobject(, "outlook.application") set rng = activesheet.range("b2") f = dir(msg_path & "*.msg") while len(f) > 0 set m = ol.createitemfromtemplate(msg_path & f) doc.body.innerhtml = m.htmlbody m.close false each t in doc.getelementsbytagname("table") rng.offset(0, -1).value = f r = 0 t.rows.length - 1 set rw = t.rows(r) c = 0 rw.cells.length - 1 'ignore problems merged cells etc on error resume next rng.offset(r, c).value = rw.cells(c).innertext on error goto 0 next c next r set rng = rng.offset(t.rows.length + 5) next t f = dir() loop end sub
Comments
Post a Comment