PDA

View Full Version : Adding attachment to the lotus notes via evcel VBA



SenjurianzFC
09-16-2014, 06:20 PM
Hi,

I have created a coding that function to generate e-mail that will
copy certain information to the lotus mail. It works fine up to now.

The problem occurs when i want to attch the worksheet to the e-mail as an attachmnet. I dont know how to make this coding that
enable this.



Sub Save_and_email_PDF()
Dim NSession As Object
Dim NDatabase As Object
Dim NUIWorkSpace As Object
Dim NDoc As Object
Dim NUIdoc As Object
Dim WordApp As Object
Dim subject As String
Dim EmailAddress As String
Dim s(1 To 100) As String
Dim ws1 As Worksheet

Set ws1 = ActiveWorkbook.Sheets("PD_lab")
subject = ws1.Range("A1")
EmailAddress = ""

'Debug.Print subject
Set NSession = CreateObject("Notes.NotesSession")
Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace")
Set NDatabase = NSession.GETDATABASE("", "")
If Not NDatabase.IsOpen Then NDatabase.OPENMAIL
Set NDoc = NDatabase.CREATEDOCUMENT
With NDoc
.SendTo = EmailAddress
.CopyTo = ""
.subject = subject
s(1) = "Hi PD Lab members" & vbCrLf
s(2) = ws1.Range("A63") & vbCrLf
s(3) = ws1.Range("A65") & vbCrLf
s(4) = ws1.Range("A3") & ws1.Range("D3")
s(5) = ws1.Range("A4") & ws1.Range("D4")
s(6) = ws1.Range("A5") & ws1.Range("D5")

.body = Join(s, vbCrLf) & " "
.Save True, False
End With

NUIWorkSpace.EDITDOCUMENT True, NDoc
Set NDoc = Nothing
Set WordApp = Nothing
Set NSession = Nothing
End Sub

SenjurianzFC
09-16-2014, 10:16 PM
Hi,

I have created a coding that function to generate e-mail that will
copy certain information to the lotus mail. It works fine up to now.

The problem occurs when i want to attch the worksheet to the e-mail as an attachmnet. I dont know how to make this coding that
enable this.

SenjurianzFC
09-16-2014, 10:17 PM
'Set up the embedded object and attachment and attach it
If attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", attachment, "Attachment")
MailDoc.CREATERICHTEXTITEM ("Attachment")
End If

mancubus
09-17-2014, 12:23 AM
hi.
below may give you an idea. modify to suit.

Lotus Notes: Send the active sheet as an attachment
http://www.rondebruin.nl/win/s1/notes/notes7.htm


Lotus Notes: Send a workbook as attachment to a created e-mail
http://www.rondebruin.nl/win/s1/notes/notes4.htm