Hello, I’ve tried everything I can think of and scoured the web for ideas on how to resolve this.
What I want to do:
Send an excel file on our lan using an existing stationery in Lotus Notes from Excel. The stationery has a list of recipients, a subject and some text in the body. The file will be attached and sent using the stationery. Once sent I expect an entry in the sent items to show up.
We use Excel 2010 and Lotus Notes client 7.03
I have the following code does essentially what I want except that I can’t get the sent email to show up in the sent items. Actually I can get it to show up in the sent items but it creates a duplicate stationery in the Stationery view as well and if I delete the copy in the Stationery view the sent item copy is simultaneously deleted. When I view the properties I see that they both have the same NoteID.
Note: sStationeryName contains the NoteID of the stationery and it passed via another sub
Function SendUsingStationery(sStationeryName As String, sAttachmentPath As String) As Boolean
Dim nSess As NotesSession
Dim nDir As NotesDbDirectory
Dim nDb As NotesDatabase
Dim nDoc As NotesDocument
Dim nView As NotesView
Dim nEntries As NotesViewEntryCollection
Dim nViewEntry As NotesViewEntry
Dim nAtt As NotesRichTextItem
Dim x As Integer
Dim nCopyDoc As NotesDocument
'On Error GoTo ErrorHandler
Set nSess = CreateObject(“Lotus.NotesSession”) 'New:{29131539-2EED-1069-BF5D-00DD011186B7}
Call nSess.Initialize
Set nDir = nSess.GetDbDirectory(“”)
Set nDb = nSess.GetDatabase(“”, “”, False)
Set nDoc = nDb.GetDocumentByID(sStationeryName)
Set nCopyDoc = nDb.CreateDocument
Call nDoc.CopyAllItems(nCopyDoc, True)
With nCopyDoc
.RemoveItem ("Attachment")
Set nAtt = .CreateRichTextItem("Attachment")
With nAtt
Call .EmbedObject(1454, "", sAttachmentPath) '1454 = Constant for EMBED_ATTACHMENT
End With
Call .ReplaceItemValue("PostedDate", Now()) <--- This was listed on the web as a solution to make it show up in sent items but doesn't seem to help.
.SaveMessageOnSend = True <-- This will save the message in the sent folder but also saves a duplicate in the Stationery view.
.PutInFolder ("Sent") <-- I tried this as a way to force the saved copy to be moved to the Sent Items but doesn't seem to help
.send (False)
End With
Set nDb = Nothing
Set nSess = Nothing
Set nDir = Nothing
Set nDoc = Nothing
Set nView = Nothing
Set nCopyDoc = Nothing
SendUsingStationery = True
Exit Function
ErrorHandler:
SendUsingStationery = False
End Function
At first I was not creating a copy of te stationery and found that the attachment that I added was actually being saved in the Stationery itself in the stationery view. I also noticed that when i didn’t create a new document and copyallitems into that new document that the NoteID of the copy in the Sent folder was identical to the copy in the Stationery view. It was essentially the same file in 2 different views so any time I would send another attachment there was only 1 copy of the email in the sent items that was just perpetually being updated. Instead of multiple sent entries.
I seem to be missing somethingabout the way that Notes works here. Any advice would be greatly appreciate.
As a note, when I just go into Notes and double click on the stationery, attach a file manually and hit send, a copy of the sent item is saved in the Sent folder with a new NoteID and the original Stationery is not modified. That is what I would expect to happen from the code above but is not happening.