Hi,
I’m new to the IBM forums so hope this is posted to the correct place in the expected format.
Some quick background… I’m confident at Excel VBA but new to Lotus Notes 8.5. I am using the code below to create an email, it works, but Notes is putting the ‘Signature’ before the message body.
Is anyone able to advise a way to test for the ‘Signature’ and either turn it off prior to creating the email or ideally apply the signature after the main body of the message.
Sub LotusNotesEmail()
Dim oWorkSpace As Object
Dim oSession As Object
Dim oDatabase As Object
Dim uiDB As Object
Dim oNotesDoc As Object
Dim oRichTextBody As Object
Dim oServer As String
Dim oMailFile As String
On Error GoTo ErrTrap
'Set-up connection to Lotus Notes and Create Email object
Set oWorkSpace = CreateObject("Notes.NotesUIWorkspace")
Set oSession = CreateObject("Notes.NotesSession")
oServer = oSession.GetEnvironmentString("MailServer", True)
oMailFile = oSession.GetEnvironmentString("MailFile", True)
Set oDatabase = oSession.GetDatabase(oServer, oMailFile)
Set uiDB = oWorkSpace.CURRENTDATABASE
Set oNotesDoc = oDatabase.CreateDocument
Set oRichTextBody = oNotesDoc.CreateRichTextItem("Body")
'Set-up dist list, message and attachments
oNotesDoc.SendTo = "test@test.com ' To..."
oNotesDoc.Subject = "Test Subject" ' The subject
oNotesDoc.Body = "This is a test" ' Any text to be in the email
On Error Resume Next
Dim uiDoc As Object
Set uiDoc = oWorkSpace.editdocument(True, oNotesDoc)
On Error GoTo 0
ErrTrap:
'Close connection to free memory
Set oSession = Nothing
Set oDatabase = Nothing
Set oNotesDoc = Nothing
Set oWorkSpace = Nothing
End Sub