Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email by Lotus Notes

Status
Not open for further replies.

Brandis

IS-IT--Management
Jun 26, 2001
16
BR
Hi,

How to write a macro for sending a report in email by Lotus Notes?

please help me asap

Bye
 
Code:
Sub EMailUsingLotusNotes(strSubject As String, strFile As String, _
    strAddress As String, Optional strCopyTo As String, Optional strBody As String)
On Error GoTo Err_EMailUsingLotusNotes

    ' Sends simple email using Lotus Notes
    ' Does NOT Require Reference to Lotus Notes Object Library
    ' does not save to users sent box
    
    Dim LotusSes As Object  ' Lotus Notes Session
    Dim LotusDbs As Object ' Lotus Notes Database
    Dim LotusDoc As Object ' Lotus Notes Document
    Dim LotusItem As Object ' Lotus Notes RichTextFile
    Dim AttachedFile As Object ' Attachment
    
    Set LotusSes = CreateObject("Notes.NotesSession")
    Set LotusDbs = LotusSes.GETDATABASE("", "")
    LotusDbs.OPENMAIL
    Set LotusDoc = LotusDbs.CREATEDOCUMENT()
    Set LotusItem = LotusDoc.CREATERICHTEXTITEM("Attachment")
    Set AttachedFile = LotusItem.EMBEDOBJECT(1454, "", strFile, "Attachment")
    LotusDoc.CREATERICHTEXTITEM ("Attachment")
    With LotusDoc
        .Subject = strSubject
        .Body = strBody
        .SendTo = strAddress
        .CopyTo = strCopyTo
        .SAVEMESSAGEONSEND = True
        .Send False
    End With
    
ExitHere:
    Set LotusSes = Nothing
    Set LotusDbs = Nothing
    Set LotusDoc = Nothing
    Exit Sub
    
Err_EMailUsingLotusNotes:
    MsgBox "Error: Email was not sent to " & strAddress, _
        vbOKOnly, "Error Sending Email!"
    Resume ExitHere
    
End Sub
 
Hi,

But how to send to many addresses I tried giving many of them separated by commas or semicolons. But they dont work.

Any idea?

 
Well... I'm a beginning programmer so perhaps someone else has a better solution, but using this code if I need to mail to more than one person, I make groups within Lotus so you only have to plug in one name.
 
Could you send me by email the real code. I was trying to run this code and I did not have success.
Email me brandis@uol.com.br

You can use real situation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top