Option Explicit


Sub Send_Range_Lotus()
'Using late binding for Lotus
'A reference to Microsoft Forms 2.0 object library must be set.

Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim stSubject As Variant, stTitle As String
Dim vaRecipient As Variant, vaMsg As Variant
Dim rnBody As Range
Dim Data As DataObject

stSubject = "Standardmessage, automation e-mail."

Do
vaRecipient = Application.InputBox( _
Prompt:="please entrer the recipient mailaddress:" & _
vbCrLf & "(excel@microsoft.com or just the name)", _
Title:="Recipient", _
Type:=2)
Loop While vaRecipient = ""

If vaRecipient = False Then Exit Sub

Do
vaMsg = Application.InputBox( _
Prompt:="Please enter the message-text:", _
Title:="Message", _
Type:=2)
Loop While vaMsg = ""

On Error Resume Next
Set rnBody = Application.InputBox("Please enter the range:", _
, Selection.Address, , , , 8)
If rnBody Is Nothing Then Exit Sub
On Error GoTo 0

Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")

If noDatabase.IsOpen = False Then noDatabase.OPENMAIL

Set noDocument = noDatabase.CreateDocument
rnBody.Copy
Set Data = New DataObject
Data.GetFromClipboard

With noDocument
.Form = "Memo"
.SendTo = vaRecipient
.Subject = stSubject
.Body = Data.GetText
.SaveMessageOnSend = True
End With

noDocument.PostedDate = Now()
noDocument.Send 0, vaRecipient

Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing

AppActivate "Microsoft Excel"
Application.CutCopyMode = False

MsgBox "E-mail have been created.", vbInformation

End Sub