Reading stationery using Excel VBA

Hi all

Please accept my apologies if this is in the wrong place.

I’m in the middle of creating an auto-mailer via Excel VBA (and got most of it working) but I’ve run across a small(ish) snag.

To save me about 3 hours work, I need to get the following items:

To list

CC list

BCC list

Subject line

The message body text

Is there any way of getting VBA to read all the stationeries on our inbox (it’s shared) and giving me the info I need?

I currently have this code, but it’s not working :-

Sub test_reader()

Dim MailDbName As String

Dim Maildb As Object

Dim MailDoc As Object

Dim AttachME As Object

Dim Session As Object



Sheets("Sheet1").Select



Set Session = CreateObject("Notes.NotesSession")



MailDbName = "name.nsf"

Set Maildb = Session.GETDATABASE("CVNDM01", MailDbName)

If Maildb.IsOpen = False Then

    Maildb.OPENMAIL

End If



Set MailDoc = Maildb.createdocument



counter = 1

For Each stationery In Maildb

    Range("A" & counter) = MailDoc.sendto

    Range("B" & counter) = MailDoc.copyto

    Range("C" & counter) = MailDoc.blindcopyto

    Range("D" & counter) = MailDoc.Subject

    Range("E" & counter) = MailDoc.body

    counter = counter + 1

Next



'reset all objects to null

Set Maildb = Nothing

Set MailDoc = Nothing

Set AttachME = Nothing

Set Session = Nothing

Set EmbedObj1 = Nothing

End Sub