Generate e-mail from Excel to Lotus Notes

could an Expeert provide me with VBA code that will generate an e-mail.

In Excel we use a checkbox that will insert the time and the user name. When the checkbox is ticked I would like to generate an e-mail through Lotus Notes.

Please see attached file which I hope is self explanitory.
e-mail.xlsm
JagwarmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

Sub SendEMail()
    Dim cb As CheckBox
    Set cb = ActiveSheet.CheckBoxes(Application.Caller)
    With cb
        
        With .TopLeftCell
            If cb.Value = msoCTrue Then
                .Offset(0, 1).Value = Now()
                .Offset(0, 2).Value = Environ("username")
                Call SendMail
            Else
                .Offset(0, 1).Resize(, 2).ClearContents
            End If
        End With
        
    End With
End Sub


Sub SendMail()
'

Dim Session As Object
Dim MailDbName As String
Dim Maildb As Object
Dim MailDoc As Object

Dim Recipient As Variant


Application.ScreenUpdating = False
Application.DisplayAlerts = False
Recipient = InputBox("Email recipient?")
If Recipient <> "" Then
    Set Session = CreateObject("Notes.NotesSession")
    MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    Set Maildb = Session.GetDatabase("", "")
    If Maildb.IsOpen = True Then
    Else
    Maildb.OPENMAIL
    End If
    
    
    Set MailDoc = Maildb.CREATEDOCUMENT
    
    MailDoc.Form = "Memo"
    
    
    MailDoc.SendTo = Recipient
    MailDoc.Subject = "PUT YOUR SUBJECT HERE"
    MailDoc.Body = Sheets("Static").Range("A1").Value
    
    MailDoc.PostedDate = Now()
    
    MailDoc.SEND 0, Recipient
    
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set Session = Nothing
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True



End Sub

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JagwarmanAuthor Commented:
That is brilliant Rgonzo many thanks
0
JagwarmanAuthor Commented:
Rgonzo I am going to post a similar quest but the new question is copy a data range from Excel into Lotus Notes e-mail.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.