Solved

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

Posted on 2008-10-16
16
4,783 Views
Last Modified: 2013-12-18
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,

Joe.


ps Notes version is 6.5 and MS Word version is 2003.
0
Comment
Question by:jpirozzolo
  • 6
  • 5
  • 2
  • +3
16 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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...?
0
 
LVL 6

Expert Comment

by:Jeews
Comment Utility
Please check the following URL which will solve your issue and hope the attached files also will help you for this.

http://searchdomino.techtarget.com/tip/1,289483,sid4_gci1101621,00.html


0
 

Author Comment

by:jpirozzolo
Comment Utility
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.  :)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
DAMO: Domino Access for Microsoft Outlook
http://www.ibm.com/developerworks/lotus/library/damo/
http://searchdomino.techtarget.com/generic/0,295582,sid4_gci1271194,00.html

Google for
   Lotus DAMO Outlook

There's also a Microsoft equivalent (they say); a Lotus Domino connector.
http://kevinmarquette.blogspot.com/2008/01/get-outlook-2007-work-with-lotus-domino.html
0
 
LVL 17

Accepted Solution

by:
wobbled earned 400 total points
Comment Utility
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

     Else

         Maildb.OPENMAIL

     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
 

Err_SendNotesMail:

    Exit Sub
 

End Sub

Open in new window

0
 
LVL 63

Expert Comment

by:SysExpert
Comment Utility
0
 

Author Comment

by:jpirozzolo
Comment Utility
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.  :)
0
 

Author Comment

by:jpirozzolo
Comment Utility
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.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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?
0
 

Author Comment

by:jpirozzolo
Comment Utility
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.
0
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 100 total points
Comment Utility
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.
0
 
LVL 17

Expert Comment

by:wobbled
Comment Utility
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
0
 

Author Comment

by:jpirozzolo
Comment Utility
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,

Joe.
0
 

Expert Comment

by:LDeahl
Comment Utility
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.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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.
0
 

Author Comment

by:jpirozzolo
Comment Utility
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.
J.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now