Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extract Data from Specific Folder

23 views
Skip to first unread message

tys...@gmail.com

unread,
Jun 7, 2013, 7:18:39 PM6/7/13
to
So I think I'm 90% of where I want to be, and I'm hoping someone can help me.

The code below works great, but it has two problems for what I need. I do not want it pulled from "CurrentFolder," I want it to always pull from the inbox. And the second part of my problem its not my main inbox, it's on a second account I have linked in my outlook (for example sake call it "bob...@hotmail.com").

Help would be greatly appreciated,



Sub Extract()

On Error Resume Next
Set myOlApp = Outlook.Application
Set myNameSpace = myOlApp.GetNamespace("mapi")
'==this is my issue, I do not want it coming from currentfolder==
Set myfolder = myOlApp.ActiveExplorer.CurrentFolder
Set xlobj = CreateObject("excel.application.14")
xlobj.Visible = True
xlobj.workbooks.Add
xlobj.Range("A" & 1).Value = "Recieved time"
xlobj.Range("B" & 1).Value = "Sender"
xlobj.Range("C" & 1).Value = "Subject"
xlobj.Range("D" & 1).Value = "Size"
For i = 1 To myfolder.Items.Count
Set myitem = myfolder.Items(i)
msgtext = myitem.Body

xlobj.Range("A" & i + 1).Value = myitem.ReceivedTime
xlobj.Range("B" & i + 1).Value = myitem.Sender
xlobj.Range("C" & i + 1).Value = myitem.Subject
xlobj.Range("D" & i + 1).Value = myitem.Size

Next
End Sub
0 new messages