Solved

Word macro to send an email to a mailbox on the mail server

Posted on 2004-10-12
4
216 Views
Last Modified: 2013-12-18
We are using Lotus Notes R5. We receive our pay slips in a single Word document.  I have been tasked with simplifying the distribution of the payslips to th individual employees.  I have written a Word macro which seperates th slips into individual Word documents and the documets are saved as the the employee's short-email-address.doc (ex JohnS.doc) .  The files ase saved on the mail server.  How can I best have an agent send these payslips to the individual recipients?  

For example, would it be possible for the Word macro to send an email to a mailbox on the mail server which would trigger the agent to run when the email arrives?
All suggestions will be appreciated.
0
Comment
Question by:witgrefe
[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
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
qwaletee earned 25 total points
ID: 12290676
Better to have the Word macro just send teh payslips directly, rather than depositing them on the server and then having an agent do them.  Here's a simple function in VBA to do this:

Sub SendSlip ( notesSession , shortName As String , attachmentFilePath As String)
    Set dbDir = notesSession.getDbDirectory()
    Set myMail = dbDir.openMailFile()
    Set msg = myMail.CreateDocument()
    msg.replaceItemValue "Form" , "Memo"
    msg.replaceItemValue "SendTo" , shortName
    msg.replaceItemValue "Subject" , "Pay stub enclosed"
    Set body = msg.createRichTextItem("Body")
    body.embedObject 1454 , "" , attachmentFilePath
    msg.send False
End Sub

Just pass it a notesSession onject, the short name string, and a string containing teh full path name of the file.

How to create a NotesSession?  Attach the TLB from the Notes directory to your VBA project, then...

Dim s as New Lotus.NotesSession
s.Initialize("your Notes password")

You can now pass --> s <-- as the first parameter.
0
 

Author Comment

by:witgrefe
ID: 12298131
Hello Qwaletee,

I presume you mean the notes32.tlb, but I not sure that I know how to attach it to the macro.  The macro is in a .dot template.  Does that make any difference?

Regards
0
 
LVL 1

Assisted Solution

by:yangshuhua
yangshuhua earned 25 total points
ID: 12339908
It's domobj.tlb. in Lotus Notes data  folder on your local computer.

Sherry

0
 

Author Comment

by:witgrefe
ID: 12361186
Thanks Sherry,

my problem is that I do not know how to 'attach' it.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

688 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