Hi all, attempting to use some more Lotus Notes Code of Nates and am running into a problem. I cannot get it to cc: multiple people. Anyone know of a way? Thanks for your help
Sub SendMail()
Sheets("Menu").Select
Range("e5").Select
whatFile = ActiveCell.Value
Range("a5").Select
whatMonth = ActiveCell.Value
ExcelFileName = "Testing " & whatFile & " " & whatMonth
Dim Maildb As Object, MailDoc As Object, AttachMe As Object, Session As Object
Dim UserName As String, MailDbName As String
Dim EmbedObj1 As Object
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDataBase(vbNullString, MailDbName)
If Not Maildb.IsOpen Then Maildb.OpenMail
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.SendTo = "me@somewhere.com"
MailDoc.CopyTo = "you@somewhere.com, urmama@somewhere.com"
'MailDoc.BlindCopyTo = "bccRecipient"
MailDoc.Subject = whatFile & " Purchases for " & whatMonth 'Subject of e-mail
MailDoc.Body = "Hello, " & vbNewLine & vbNewLine & "Attached is the " & whatFile & _
" Manifest File for " & whatMonth & vbNewLine & vbNewLine
Set AttachMe = MailDoc.CreateRichTextItem("Attachment")
Set EmbedObj1 = AttachMe.Embedobject(1454, vbNullString, _
"C:\Manifests\" & ExcelFileName & ".xls", "Attachment") 'Attaches file to e-mail
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
On Error GoTo ErrorCheck
Call MailDoc.Send(False)
Exit Sub
Set EmbedObj1 = Nothing: Set AttachMe = Nothing: Set MailDoc = Nothing
Set Maildb = Nothing: Set Session = Nothing
ErrorCheck:
Set EmbedObj1 = Nothing: Set AttachMe = Nothing: Set MailDoc = Nothing
Set Maildb = Nothing: Set Session = Nothing
End Sub
Sub SendMail()
Sheets("Menu").Select
Range("e5").Select
whatFile = ActiveCell.Value
Range("a5").Select
whatMonth = ActiveCell.Value
ExcelFileName = "Testing " & whatFile & " " & whatMonth
Dim Maildb As Object, MailDoc As Object, AttachMe As Object, Session As Object
Dim UserName As String, MailDbName As String
Dim EmbedObj1 As Object
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDataBase(vbNullString, MailDbName)
If Not Maildb.IsOpen Then Maildb.OpenMail
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.SendTo = "me@somewhere.com"
MailDoc.CopyTo = "you@somewhere.com, urmama@somewhere.com"
'MailDoc.BlindCopyTo = "bccRecipient"
MailDoc.Subject = whatFile & " Purchases for " & whatMonth 'Subject of e-mail
MailDoc.Body = "Hello, " & vbNewLine & vbNewLine & "Attached is the " & whatFile & _
" Manifest File for " & whatMonth & vbNewLine & vbNewLine
Set AttachMe = MailDoc.CreateRichTextItem("Attachment")
Set EmbedObj1 = AttachMe.Embedobject(1454, vbNullString, _
"C:\Manifests\" & ExcelFileName & ".xls", "Attachment") 'Attaches file to e-mail
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
On Error GoTo ErrorCheck
Call MailDoc.Send(False)
Exit Sub
Set EmbedObj1 = Nothing: Set AttachMe = Nothing: Set MailDoc = Nothing
Set Maildb = Nothing: Set Session = Nothing
ErrorCheck:
Set EmbedObj1 = Nothing: Set AttachMe = Nothing: Set MailDoc = Nothing
Set Maildb = Nothing: Set Session = Nothing
End Sub