Awhile ago, a user on here by the name of Chippy really helped me out with a code to copy and paste a range of cells into lotus notes and send it to an email address defined in the macro.
Sub Email_Excel_Cells()
Dim NSession As Object
Dim NUIWorkSpace As Object
Dim NDoc As Object
Dim NUIdoc As Object
Set NSession = CreateObject("Notes.NotesSession")
Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace")
Set NDoc = NUIWorkSpace.ComposeDocument("", "", "Memo")
Set NUIdoc = NUIWorkSpace.CURRENTDOCUMENT
With NUIdoc
.FieldSetText "EnterSendTo", "to.email1@email.com, to.email2@email.com"
.FieldSetText "EnterCopyTo", "cc.email@email.com"
.FieldSetText "Subject", "Pasting from Excel to Lotus Notes " & Now
.FieldSetText "Body", "Excel cells are pasted below this text" & vbNewLine & vbNewLine & _
"**PASTE EXCEL CELLS HERE**" & vbNewLine & vbNewLine & _
"Excel cells are pasted above this text"
.GotoField ("Body")
.FINDSTRING "**PASTE EXCEL CELLS HERE**"
Sheets("Sheet1").Range("A1:E40").Copy 'the cells to copy and paste
.Paste
Application.CutCopyMode = False
.Send
.Close
End With
Set NUIdoc = Nothing
Set NDoc = Nothing
Set NUIWorkSpace = Nothing
Set NSession = Nothing
End Sub
The code works wonderfully for the project I was on at the time, but now I'm trying to change it a bit. What I need it to do now is send an email by referring to a cell that contains a drop-down list. The user will pick the name from the list, and then when they run the macro, it will see which name is selected and send the email. I've tried several things, but none of them have worked.
The only thing I can think of is to set up a macro for each potential email address, and then have a seperate macro that runs a "call macro" depending on what name is showing in the list. But I'm certain there has to be an easier way.
Anyone have any ideas? Thanks in advance for any help that is offered.
Bookmarks