A consultant designed an Outlook survery form that pulls survery data out of messages from a specific Outlook folder into Excel

He used the MAPI object from Excel to access the Outlook messages. Two queries

1) Why use MAPI rather than Outlook?
2) I've tried early binding from Excel with the CDO Reference rather than late binding. I get a runtime error (MAPI_E_No_ Found) as I track down the folder sytem to "Minerals". For some reason the Folder points to "Favourites" rather than "All Public Folders". The consultant made reference to this issue in his code. If i use
[vba]
Set MAPIfold = MAPIobj.InfoStores("Public Folders").RootFolder.Folders(2)
[/vba]
it works but i'd like to know why there is an issue



Cheers

Dave


--His Code--

[vba]
Set oObject = CreateObject("MAPI.Session")
oObject.Logon , , False, False
Set oFolder = oObject.InfoStores("Public Folders")
Set oFolder = oFolder.RootFolder

' Strange thing you seem to have to do for the RootFolder of an InfoStore!

For i = 1 To oFolder.Folders.Count
If oFolder.Folders(i).Name = "All Public Folders" Then
Set oFolder = oFolder.Folders(i)
Exit For
End If
Next
Set oFolder = oFolder.Folders("Minerals")
[/vba]

---My code----

[vba]
Sub GeteMail()
Dim MAPIobj As MAPI.Session, MAPIfold As MAPI.Folder
Set MAPIobj = New MAPI.Session
MAPIobj.Logon , , False, False

Set MAPIfold = MAPIobj.InfoStores("Public Folders").RootFolder.Folders("All Public Folders")
'my code fails below
Set MAPIfold = MAPIfold.Folders("Minerals")
End Sub
[/vba]