Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 405
  • Last Modified:

Modify Subject Line of a memo from Querysend

Hey Experts,
Here is a typical subject on a memo:
Invoice Credit - XX Client 1186-P0001 [1186-G0001;1186-P0001]
What I need to do is delete the brackets and anything between the brackets but keep any data before or after the brackets...my code is below, what I have been doing is deleting everything after the [ (left bracket) of course requirements have changed and I am a little stumped. I tried a few methods but I cannot seem to NOT delete anything pass the right bracket....ideas suggestions?
'Remove old jobnumbers before mailing
		If Instr(source.Document.subject(0)," [" ) = 0 Then
			Subject$ = Trim(Strleft(source.Document.Subject(0),"["))
			Call Source.FieldSetText("Subject",Subject$)
		End If

Open in new window

  • 2
1 Solution

Pos1 = Instr(source.Document.subject(0)," [" )
If pos1 > 0 then
   pos2= Instr(source.Document.subject(0)," ]" )
    Subject$ = Trim(Mid$( source.Document.subject(0) , 1,pos1-1) + Mid$( source.Document.subject(0) , pos2 +1, Len( source.Document.subject(0) ) -pos2 )

ENd if

untested, but this takes the first have up to the [ sing MID$, and then takes the 2nd half, after the ]

I hope this helps !
padillrrProject CoordinatorAuthor Commented:
Been on another project will give this a try this week...
padillrrProject CoordinatorAuthor Commented:
Was taking to long to work on this, still haven't given it a try will do so when I get back on this project...Thanks

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now