Mail Merge from MS Word and email the attachment using Lotus Notes.

Hi Experts,

I wonder if you could help me as I am a bit stuck.  I need someone to help me Mail Merge using MS Word, and email the word document using Lotus Notes (the email address is in an excel spreadsheet along with other merge data (name/address etc).

Everything is setup and the mail merge works fine using outlook.  However, the office where the mailmerge will be running does not use Outlook but Lotus Notes (v6.5).  Is there a way I can merge and email using Lotus Notes.

Thanks very much and I look forward to any help.

Kind Regards,


ps Notes version is 6.5 and MS Word version is 2003.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
For what it's worth...

You could continue to use Outlook as a mail client for this specific purpose. There are ways to make Outlook a mail client to a Domino server, e.g. DAMO, and POP3.

Two cents...?
Please check the following URL which will solve your issue and hope the attached files also will help you for this.,289483,sid4_gci1101621,00.html

jpirozzoloAuthor Commented:
Oh wow!  thanks folks for the very fast reply.

sjef_bosman:,  I know I can't use POP3 as it has been disabled on the server and they will not let me use it, however I am not familiar with DAMO.  I'm just about to google it.  The problem I have is that I have full access to excel and word (so I can write/use VBA macros etc) but I have no access to Lotus Notes, just a normal users ability to send and receive email.

Jeews: thanks very much for the link, unfortunately my predicament is the other way around.  I already have the merge working in word, I just need to send the merge via email using Lotus Notes.

Thanks for the suggestions so far.  :)
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Sjef BosmanGroupware ConsultantCommented:
DAMO: Domino Access for Microsoft Outlook,295582,sid4_gci1271194,00.html

Google for
   Lotus DAMO Outlook

There's also a Microsoft equivalent (they say); a Lotus Domino connector.
Hi, If you are doing all of this within Word and the user has Lotus Notes on their PC then you could use the code below.  All you would need to do is to close the merged document, store its path in a variable and then call the code below and attach the file
Public Sub SendNotesMail(Subject As String, Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean)
'Set up the objects required for Automation into Lotus Notes 
'This public sub will send a mail and attachment if neccessary to the recipient including the body text.
'Requires that notes client is installed on the system.
Dim Maildb As Object        'The mail database
Dim Username As String      'The current users notes name
Dim MailDbName As String    'The current users notes mail database name
Dim MailDoc As Object       'The mail document itself
Dim AttachME As Object      'The attachment richtextfile object
Dim Session As Object       'The notes session
Dim EmbedObj As Object      'The embedded object (Attachment)
On Error GoTo Err_SendNotesMail
    'Start a session to notes
    Set Session = CreateObject("Notes.NotesSession")
    'Next line only works with 5.x and above. Replace password with your password
    'Session.Initialize ("password")
    'Get the sessions username and then calculate the mail file name
    'You may or may not need this as for MailDBname with some systems you
    'can pass an empty string or using above password you can use other mailboxes.
    Username = Session.Username
    MailDbName = Left$(Username, 1) & Right$(Username, (Len(Username) - InStr(1, Username, " "))) & ".nsf"
    'Open the mail database in notes
    Set Maildb = Session.GetDatabase("", MailDbName)
     If Maildb.IsOpen = True Then
          'Already open for mail
     End If
    'Set up the new mail document
    Set MailDoc = Maildb.CreateDocument
        MailDoc.Form = "Memo"
        MailDoc.sendto = Recipient
        MailDoc.Subject = Subject
        MailDoc.body = BodyText
        MailDoc.SaveMessageOnSend = SaveIt
    'Set up the embedded object and attachment and attach it
    If Attachment <> "" Then
        Set AttachME = MailDoc.CreateRichTextItem("Attachment")
        Set EmbedObj = AttachME.EmbedObject(1454, "", Attachment, "Attachment")
        MailDoc.CreateRichTextItem ("Attachment")
    End If
    'Send the document
    MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
    MailDoc.Send 0, Recipient
    'Clean Up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj = Nothing
    Exit Sub
    Exit Sub
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jpirozzoloAuthor Commented:
Thanks very much folks.  I've got some good stuff to try out here.  I'll let you know the outcome.
Thanks again and i'll be back soon.  :)
jpirozzoloAuthor Commented:
Sorry for delay, this is the first time I managed to get to a Notes 6.5 machine.

Thanks wobbled for that snippet of code.  
I tried running it but I get an error message at the following point:

MailDoc.CreateRichTextItem ("Attachment")  (line 49)

It says that an attachment already exists and throws up a runtime error.

Do you know what I need to do?  Thanks.
Sjef BosmanGroupware ConsultantCommented:
Do you reuse the document? Because, according to the sources, the attachment is created in a brand new document. Or did you modify the code somewhere?
jpirozzoloAuthor Commented:
Hi sjef,
No I haven't modified the code, and everytime the SendNotesMail sub is called a new document has been created and needs to be sent using a new email message.  (If that makes sense).

Basically, the word macro creates a new merged document/ saves it/calls the SendNotesMail sub with an email address/subject/body etc, moves onto the next record and does the same process again.
Sjef BosmanGroupware ConsultantCommented:
Ah, now I see: there's three lines that should only be two:

        Set AttachME = MailDoc.CreateRichTextItem("Attachment")
        Set EmbedObj = AttachME.EmbedObject(1454, "", Attachment, "Attachment")
        MailDoc.CreateRichTextItem ("Attachment")

Remove the last line and try again.
Just checked that and sjef is correct - it works fine without an attachment, but fails if you add the line.  Of all the email clients I have ever used I have to say that Lotus Notes is the worse one by far!

Hope you get it working ok
jpirozzoloAuthor Commented:
Ahhh yes, that seems to have done the trick quite nicely!
Wobbled, I'm with you, sometimes Lotus Notes drives me up the wall!  I have this love hate relationship with it.

Thanks very much everyone for your assistance on this!  It has been a real help!

Kind Regard,

This looks promising for an issue I'm trying to solve in an all Notes shop.  However, I'm not a Notes guy...can you guys give a breif description on how to implement this?  I assume its not Lotus Script because I get a lot of syntax errors there.
Sjef BosmanGroupware ConsultantCommented:
Only people who participated in this here question will see your request. It is much more appreciated if you do the other way round: ask your own question, and place references from your question to this one and vice versa.
jpirozzoloAuthor Commented:
Hi LDeahl
Yeah, this isn't lotus script.  Actually it's VBA (working within MS Word to link into Lotus).
As sjef_bosman mentions, you are much better off asking a specific question - the experts are very quick and very good.  Hope this helps.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.