Question: I'm stuck with this problem for days

I have to read a specific mailbox in lotus notes and bring all the content into an excel spread sheet

but so far I have only been able to read the default inbox and have no way of switching to the other mailbox. I 'm really new to VBA can any one help me sort this out

here is the code I 'm using

```
Set NSession = CreateObject("Notes.NotesSession")
   'get the name of the mailfile of the current user
DbLocation = NSession.GETENVIRONMENTSTRING("mail/mailbox", True)

'Get the notesdatabase for the mail.
Set NMailDb = NSession.GETDATABASE("mailboxer", DbLocation)
MsgBox (DbLocation)

```

I get an empty msgbox poping up

Answer: 
Some thoughts:

* use Lotus.NotesSession if you don't have to interact with the Notes UI (Lotus.NotesSession is COM based, whereas Notes.NotesSession is OLE based)
* make sure the user of the Notes client on the workstation running your VBA application has the rights require to open and read the mailbox
As D. Bugger stated, you need to be sure you have the Notes client installed on the same client machine your VB code will run, and you need to be sure the folder with the nnotes.exe file and the folder with the notes.ini file are in your environment path. (If not, you will get a COM error instantiating the Notes.NotesSession object.

If this helps, here is some starter code - not tested, but a rough guide... This walks through all documents in a Notes mailbox database, ignores anything except email documents (which have the form field = "Memo") and grabs some fields from each email. 

```
Public Sub exportNotesMail(MailServer$, MailDBPath$)
    Dim mailDb As Object, doc As Object, alldocs As Object, Session As Object
    Set Session = CreateObject("Notes.NotesSession")
    Set mailDb = Session.GETDATABASE(MailServer, MailDbPath$)
    If mailDb.IsOpen = False Then mailDb.OPENMAIL
    Set alldocs = mailDb.AllDocuments
    Set doc = alldocs.GetFirstDocument
    while not (doc is nothing)
        If doc.GetItemValue("Form")(0) = "Memo" Then
            thisSubject = doc.getItemValue("Subject")(0)
            thisFrom = doc.getItemValue("From")(0)
            ' get more field values
            ' Export to Excel or wherever
        End If
        Set doc = alldocs.GetNextDocument(doc)
    Next i

    ' done
End Sub

call exportNotesMail ("MyServer", "mail\myMailFile.nsf")

```