Solved

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

Posted on 2004-10-12
4
210 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

16 Experts available now in Live!

Get 1:1 Help Now