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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple lotus attachments help

Status
Not open for further replies.

DrSmyth

Technical User
Jul 16, 2003
557
GB
Hi, i need to send a couple of attachments via lotus notes but am having a bit of trouble getting it to work. Here's my code so far:

Code:
Public Sub SendRefPSC_Click()
On Error GoTo Err_SendRefPSC_Click
Dim Maildb As Object 'the mail database
Dim username As String
Dim maildbname As String
Dim maildoc As Object
Dim attachme As Object
Dim session As Object
Dim embedobject As Object
Dim mytime As String
Dim recipient As String
Dim subject As String
Dim attachment(2) As String
Dim BodyText As String
Dim Carbon(2) As String
Dim PSM As String
Dim StrStaffNo As String
StrStaffNo = Environ("Username")
recipient = "Test E-mail1@Test.com"
Carbon(1) = "Test E-mail2@Test.com"

subject = "Referral Tracking"
attachment(1) = "C:\ReferralData.txt"
attachment(2) = "New export.XLS"
BodyText = "Referrals Update"
Set session = CreateObject("Notes.NotesSession")
username = session.username

Set Maildb = session.GETDATABASE("", maildbname)
If Maildb.ISOPEN = True Then

Else
Maildb.OPENMAIL
End If
Set maildoc = Maildb.CREATEDOCUMENT
maildoc.Form = "Memo"
maildoc.sendto = recipient
maildoc.copyto = recipient
maildoc.subject = subject
maildoc.Body = BodyText
maildoc.SAVEMESSAGEONSEND = True
Set attachme = maildoc.CREATERICHTEXTITEM("Attachment")
Set embedobject = attachme.embedobject(1454, "", attachment, "Attachment")
maildoc.PostedDate = Now()
maildoc.send 0, recipient

Set Maildb = Nothing
Set maildoc = Nothing
Set attachme = Nothing
Set session = Nothing
MsgBox "Your Referral Log has been sent to " & recipient & " & " & Carbon(1) & ", a copy has been saved in your Lotus Notes Sent folder."

Exit_SendRefPSC_Click:
Exit Sub

Err_SendRefPSC_Click:
MsgBox Err.Description
Resume Exit_SendRefPSC_Click
End Sub

but it doesn't work..... Any suggestions would be appreciated.. Tried doing a keyword search on this forum but could only find axamples for sending a single attachment..

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top