The agent working as designed. But now I have 2 different types of emails coming in to my inbox that the agent is working on. In the message of one of the emails there is the text jobopen and the other email has jobclosed. Basically a email gets sent out when a job is started and when it is closed. So the verbage has to be differnt in the email the agent is sending out.
I think the best place to put the if statement would be in the sub.
But I am not sure how I would go about passing the value of jobopen or jobclosed to the sub?
Sub SendMemoFromTag(memo As NotesDocument, Byval tagStart As String, Byval tagEnd As String)
Dim sess As New NotesSession
Dim parts As Variant
Dim body As String, sendto As String
sess.ConvertMime = True
body = memo.GetItemValue("Body")(0)
If (Instr(1, body, tagStart, 5) = 0) Then Exit Sub
parts = Split(body, tagStart)
If (Instr(1, parts(1), tagEnd, 5) = 0) Then sendto = Trim(parts(1)) Else sendto = Trim(Strleft(parts(1), tagEnd))
Dim memo2 As NotesDocument
Set memo2 = memo.ParentDatabase.CreateDocument
memo2.Form = "memo"
memo2.Subject = "Model Shop Job Completed for " & sendto
memo2.Body = "Your job is completed. Please come and pick up the part."
memo2.SendTo = sendto