Solved

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

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

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

Title # Comments Views Activity
Lotus Notes 41 223
Lotus notes "Estimate" form to Quickbooks invoice 2 366
Lotus Notes 8.5 1 163
Domino Server 2 84
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

696 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