I am trying to create a macro which will open a new lotus notes mail, attaches certain files to it and copy and paste the body from a stationery mail.
I am stuck in the last part where I have to copy the BODY of the stationery mail and paste it in the new mail which I have created.
Below is the code which I have tried, but only the files are getting attached but unable to copy the body from the stationery
Any Help is appreciated........
isattached = False
Application.ScreenUpdating = False
'Start Lotus Notes Session
Set nSession = CreateObject("Notes.NotesSession")
On Error GoTo err_send
Set nMailDb = nSession.GetDatabase("", "mailin/GBG180.nsf")
' Open the Stationery View
Set nView = nMailDb.GetView("Stationery")
Set nWorkspace = CreateObject("Notes.NotesUIWorkspace")
Set nCursor = nView.GetFirstDocument
Do While Not nCursor Is Nothing
' get stationery value
StationeryName = nCursor.GetItemValue("MailStationeryName")(0)
' match form template selection versus stationery
If StationeryName = St_name Then
Set nMailDoc = nMailDb.CreateDocument("Memo")
Set AttachME = nMailDoc.CreateRichTextItem("ATTACHMENT")
'Open the PDF folder and attach the files
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(PdfPath)
For Each objFile In objFolder.Files
Set EmbedObj = AttachME.EmbedObject(1454, "", PdfPath & objFile.Name)
isattached = True
Application.Wait (15)
Next
subjectname = policy_num & "-" & aname & "-FoS Invoice & Wording" & " " & Format(DateValue(Now()), "YYYY") & "- Confidential"
If (isattached) Then
'Set nMailDoc = nWorkspace.EDITDOCUMENT(True, nCursor)
nMailDoc.Subject = subjectname
Else
Set nMailDoc = Nothing
Set AttachME = Nothing
Exit Function
End If
nMailDoc.Save True, True, False
Set nMailDoc = Nothing
Set nCursor = Nothing
GoTo nMail_OK
Else
Set nCursor = nView.GetNextDocument(nCursor)
End If
Loop