Hi,
I have a vba code that extracts outlook email information and places it in excel. However, i am getting a "Next without for" compile error. Any help would be greatly appreciated.
Many Thanks!
B:
Sub Exportoutlook()
i=0
With GetNamespace("MAPI").getdefaultfolder(6)
Redim sn (.items.count,9)
For Each it In .items
c01=""
For j=0 To UBound(sn,2)
sn(i,j)=choose(j+1,it.to, it.sendername,it.cc,it.subject,it.body,it.senton,it.size,it.attachments.count,"",it.receivedtime)
Next
For Each at In it.attachments
c01=c01 & "," & at.filename
Next
sn(i,8)=c01
Next
i=i+1
Next
With getobject("C:\Outlookexport\Outlook.xls")
.sheets(1).cells(1).resize(UBound(sn)+1,UBound(sn,2)+1)=sn
.close True
End With
End Sub
Bookmarks