next
06-19-2012, 07:51 AM
I haven't dealt with Outlook VBA yet, so this is my first attempt and I'm getting nowhere :dunno
Here's what I'm trying to do: I have a folder "CWI Customers", within that folder there's another one "AEO". I need to go through all emails in that folder, then retrieve the subject line and attachment name.
To test how things work I figured I'll just get the title of all items in my inbox, but it's not working. Here's my code:
Sub test()
Dim ns As NameSpace
Dim item As Object
Dim inbox As MAPIFolder
'Dim sub_folder As MAPIFolder
Set ns = GetNamespace("MAPI")
Set inbox = ns.GetDefaultFolder(olFolderInbox)
'Set sub_folder = inbox.Folders("AEO")
For Each item In inbox
Debug.Print item.Title
Next item
End Sub
Here's what I'm trying to do: I have a folder "CWI Customers", within that folder there's another one "AEO". I need to go through all emails in that folder, then retrieve the subject line and attachment name.
To test how things work I figured I'll just get the title of all items in my inbox, but it's not working. Here's my code:
Sub test()
Dim ns As NameSpace
Dim item As Object
Dim inbox As MAPIFolder
'Dim sub_folder As MAPIFolder
Set ns = GetNamespace("MAPI")
Set inbox = ns.GetDefaultFolder(olFolderInbox)
'Set sub_folder = inbox.Folders("AEO")
For Each item In inbox
Debug.Print item.Title
Next item
End Sub