[Originally posted by Andrew Murphy]

I need some sort of replace function that will do the following...

If I have a string that has the following (I will use VB code for
simplicity)

If Label1.Caption = "hi" Then Label1.Caption = "Bye"

and I want to make it

If Label12.Caption = "hi" Then Label12.Caption = "Bye"

then I just do a simple replace. BUT my code which I have.....

If InStr(1, Form3.Text1.Text, LastName) <> 0 Then ' Check for occurance of
replaced string
If InStr(1, Form3.Text1.Text, Text1.Text) = 0 Then ' has it already been
replaced?
If MsgBox(&quot;Do you wish all references to change in your text?&quot;,
vbYesNo) = vbYes Then ' Do they want to replace?
Form3.Text1.Text = Replace(Form3.Text1.Text, LastName,
Text1.Text) ' Replace
End If
End If
End If

Doesn't allowed me to make it go back again, ie replace Label12 with Label1.
BECAUSE when I do line 2 it is picking up the LABEL1 in label12. How can I
make it so that I have an instr couterpart like....

Public Sub AdvInstr(Start, MainText, StringOne, IsNotPartOf)

where it checks to see if StringOne is part of string IsNotPartOf when each
&quot;section&quot; is split up my a vbcrlf a &quot; &quot; (space) or a full stop &quot;.&quot;?

need futhur explaination?

Andrew