FindAndReplace - Please Disregard

Hello All - In my script below, I take everything from the left of the “~” and replace the subject with it. Now I need to srtip it, including the “`” from the body before I send the email.

How do I do that?

Sub Initialize

Dim session As New NotesSession

Dim collection As NotesDocumentCollection

Dim Db As NotesDatabase

Dim doc As NotesDocument

Dim PosOfDash As Integer

Dim GroupName As String, NewSubject As String, tempKMK As String, temp2kmk As String

Dim GroupView As NotesView

Dim GroupDoc As NotesDocument

Dim AgentLog As New NotesLog( "Mail Group Re-Director" )



On Error Goto ErrorHandle



Set Db = session.CurrentDatabase



Set collection = Db.UnProcessedDocuments

Set doc = collection.GetFirstDocument

Set GroupView = db.GetView( "people" )





Call AgentLog.OpenAgentLog

Call AgentLog.LogAction( "Started Running" )

’ NewSubject$ = “Remedy Notification”

’ YourString = Strleft(YourString, “~”)

’ NewSubject$ = Strleft(doc.Body, “~”)

Do While Not ( doc Is Nothing )

	' Get the Group Name

	GroupName$ = doc.Subject( 0 )

	' Determine if we already ran on this doc.

	If GroupName$ <> NewSubject$ And doc.txtProcessed( 0 ) <> "1" Then

	' Find the group in the db

		Set GroupDoc = GroupView.GetDocumentByKey( GroupName$ )

		If GroupDoc Is Nothing Then

		' Did not find the group.  Send to default group

			doc.SendTo = "O&S Remedy Notification Editors"

		Else

		' Get rid of the group from the subject line

			doc.OldSubject = doc.Subject

			doc.OldBody = doc.Body

			doc.Subject = Strleft(doc.Body, "~")

			

		' Change the SendTo names

			doc.SendTo = GroupDoc.Members

		End If

		' Set the return or FROM name

		doc.Principal = "Remedy Mail Notification"

	' Send the doc

		Call doc.Send( False )

		Call session.UpdateProcessedDoc( doc )

		doc.txtProcessed = "1"

		Call doc.Save( True , True , False )

	End If ' we already ran on this doc

	Set doc = collection.GetNextDocument( doc )

Loop



Call AgentLog.LogAction( "Finished!" )



Exit Sub

ErrorHandle:

doc.Principal = "Remedy Mail Notification - ERROR"	

doc.SendTo = "O&S Remedy Notification Editors"

doc.Subject( 0 ) = GroupName$

Call doc.Send( False )	

Resume Next



 'Print "Mail Re-Director Agent, ERROR! - " & Error() & " (" & Cstr( Err() ) & ")"

Exit Sub

End Sub

Thanks,

Pat