I am having a problem with this code, this code loops for all supervisors from the InitializeSupervisors() function.
The names of those supervisors are put in the recipients array, every time the second FOR is ran the information in the recipients is overridden there after the email is only sent to the last group of names… How can I have all of the Names in the recipients array before sending the email?
Call InitializeSupervisors ()
For counter = Lbound(Supervisors) To Ubound(Supervisors)
recipientsCount = 0
sCons_Need = doc.GetItemValue(Supervisors (counter, 2))
sRiskIndicator = doc.GetItemValue(Supervisors (counter, 3))
sResult = Approvalcheck(sCons_Need(0), sRiskIndicator(0))
If sResult = "Waiting" Then
SupervisorsName = doc.GetItemValue(Supervisors (counter, 4))
Redim recipients (1 To Ubound(SupervisorsName) +1 , recipientsCount)
recipientsCountA = 1
For x = 0 To Ubound(SupervisorsName)
recipients(recipientsCountA, recipientsCount) = SupervisorsName(x)
recipientsCountA = recipientsCountA +1
Next x
Set memItem = doc.getfirstitem(Supervisors (counter, 5))
Forall n In SupervisorsName
Call memItem.appendtotextlist(n)
End Forall
Call memItem.appendtotextlist(" " + Today)
recipientsCount = (recipientsCount + 1)
sSendReminder = "Yes"
If sSendReminder = "Yes" Then
Call SendSupervisorsReminder(recipients, doc, MessageToSend)
End If
End If
Next
Thanks,
Paul,