Hi all,
Not to confuse this question to just sending emails to multiple people, what I'm trying to do is send an email to a predefined group within Lotus Notes. The code I'm using currently is below.
Within Lotus Notes i've create a group called 'test' which contains 2 email addresses, now I want to address the email to 'test' and not have to know the individuals email addresses as the group will change constantly.
I've read pretty much all of the past emails and I can't seem to find an answer to this question.
Any suggestions would be greatly appreciated.
Not to confuse this question to just sending emails to multiple people, what I'm trying to do is send an email to a predefined group within Lotus Notes. The code I'm using currently is below.
Within Lotus Notes i've create a group called 'test' which contains 2 email addresses, now I want to address the email to 'test' and not have to know the individuals email addresses as the group will change constantly.
I've read pretty much all of the past emails and I can't seem to find an answer to this question.
Any suggestions would be greatly appreciated.
Code:
Sub NotsCoreCode()
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
' Declare Variables for file and macro setup
Dim UserName As String
Dim MailDbName As String
Dim Maildb As Object
Dim MailDoc As Object
Dim AttachME As Object
Dim Session As Object
Dim EmbedObj1 As Object
' Open and locate current LOTUS NOTES User
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
Else
Maildb.OPENMAIL
End If
' Create New Mail and Address Title Handlers
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
' Select range of e-mail addresses
recipient = "andrew.matthews"
MailDoc.SendTo = recipient
'ans = MsgBox("Would you like to Copy (cc) anyone on this message?" _
' , vbQuestion & vbYesNo, "Send Copy")
'
' If ans = vbYes Then
' ccRecipient = InputBox("Please enter the additional recipient's e-mail address" _
' , "Input e-mail address")
' MailDoc.CopyTo = ccRecipient
' End If
MailDoc.Subject = "CSB daily DOH"
MailDoc.Body = _
"Attached is a update of Documents on Hand within CSB."
' Select Workbook to Attach to E-Mail
MailDoc.SaveMessageOnSend = True
Attachment1 = "C:\CSB DOH.xls" ' Required File Name
If Attachment1 <> "" Then
On Error Resume Next
Set AttachME = MailDoc.CREATERICHTEXTITEM("attachment1")
Set EmbedObj1 = AttachME.embedobject(1454, "attachment1", "C:\CSB DOH.xls", "") 'Required File Name
On Error Resume Next
End If
MailDoc.PostedDate = Now()
On Error GoTo errorhandler1
MailDoc.Send 0, recipient
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj1 = Nothing
errorhandler1:
MsgBox ("error")
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj1 = Nothing
With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub