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
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