Posted on 2006-11-14
Have the code below I have used to capture the names on a form and send out a customized thank you letter. I have been asked to try and do something similar. I need to take this idea of pulling all the names of the attendees, but instead of sending out the preformatted email, I need to just take the names and drop them into a new standard memo, allowing the trainer to enter their text and send it off. How can I get some code to just capture all the names on the form and drop them into the To: line of a new memo.
Dim db As NotesDatabase
Set s = New NotesSession
Set db = s.CurrentDatabase
Dim dc As NotesDocumentCollection
Set dc = db.UnprocessedDocuments
Dim varNames(49) As String
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim installDate As NotesDateTime
Dim installTimeItem As NotesItem
Dim item As NotesItem
Dim i As Integer
On Error Resume Next
Set docA = dc.GetFirstDocument
For i = 1 To dc.Count
Set docA = dc.GetNthDocument( i )
If docA.form(0) = "conf_call_survey" And docA.survey_sent(0) <> "done" Then ' this is the document you're pulling names FROM
Set docB = db.CreateDocument
docB.form = "feedback_request" ' the document you want to email
docB.Subject = "Please take a moment to provide feedback on the " + docA.topic(0) + " conference call you recently attended. "
varNames(0) = docA.name(0)
varNames(1) = docA.name_1(0)
varNames(2) = docA.name_2(0)
varNames(49) = docA.name_49(0)
Set installTimeItem = docA.GetFirstItem("date")
Set installDate = installTimeItem.DateTimeValue
docB.SendTo = varNames
docB.Principal = "Service Delivery Group"
docB.CopyTo = docA.trainer
docB.topic = docA.topic
docB.topic1 = docA.topic
docB.trainer = docA.trainer(0)
docA.survey_sent = "done"
Call docB.Send (True)
message = "You have already sent a survey request for this class. This request will not be sent."
Messagebox message, MB_OK, "Alert!!"