1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| Set NSession = CreateObject("Notes.NotesSession")
Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace")
Set NDatabase = NSession.GetDatabase("", "")
If Not NDatabase.IsOpen Then NDatabase.OPENMAIL
'Create a new Lotus Notes document
Set NDoc = NDatabase.createDocument
With NDoc
.SendTo = SendTo
.CopyTo = CopyTo
.Subject = Subject
'Email body text, including a placeholder which will be replaced by the Excel cells
.body = "Please submit the following orders on EPEX " & vbLf & vbLf & _
"PLACEHOLDER" & vbLf & vbLf & _
"Thanks"
.Save True, False
End With
Set oItem = NDoc.CREATERICHTEXTITEM("{IMAGE_PLACEHOLDER}")
Call oItem.EmbedObject(1454, "", path & fName & ".xlsx")
NDoc.visable = True
'Edit the new document using Notes UI to copy and paste the Excel cells into it
Set NUIdoc = NUIWorkSpace.EDITDocument(True, NDoc)
With NUIdoc
'Find the placeholder in the Body item
.GotoField "Body"
.FINDSTRING "PLACEHOLDER"
End With
With NUIdoc
'Find the placeholder in the Body item
.GotoField "Body"
.FINDSTRING "PLACEHOLDER"
'Copy Excel cells as a bitmap to the clipboard and paste into the email
embedCells.Copy 'Picture xlBitmap
.Paste
Application.CutCopyMode = False
.sEnd
.Close
End With
Set NSession = Nothing |
Partager