Solved

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

Posted on 2008-10-16
16
4,924 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
  • +3
16 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22729859
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
ID: 22730003
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
ID: 22730085
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22730238
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
ID: 22730293
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
ID: 22731520
0
 

Author Comment

by:jpirozzolo
ID: 22732226
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
ID: 22768605
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
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22768679
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
ID: 22768971
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
ID: 22769030
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
ID: 22770437
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
ID: 22785236
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
ID: 25440455
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
ID: 25440708
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
ID: 25441174
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
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.

726 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