Modify Subject Line of a memo from Querysend

Posted on 2009-04-22
Last Modified: 2013-11-16
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 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

Question by:padillrr
    LVL 63

    Accepted 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 !

    Author Comment

    Been on another project will give this a try this week...

    Author Closing Comment

    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

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
    IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now