Solved

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

Posted on 2008-10-16
16
4,827 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
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.

863 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

26 Experts available now in Live!

Get 1:1 Help Now