tags:

views:

24

answers:

1

hi

I find way to replace word in text file as the following

strNewText = Replace(strText, "OLD_WORD", "NEW_WORD")t

but this replace every OLD_WORD in the file

my question is if it possible to replace the OLD_WORD with the NEW_WORD only on specific line

for example I want to replace only on line that start with "THIS_LOCATION"

THIS_LOCATION=OLD_WORD

THX for help

A: 

Try this:

If InStr(strText, 'THIS_LOCATION') Then
  strNewText = Replace(strText, "OLD_WORD", "NEW_WORD")
End If

The InStr function first checks if the line contains THIS_LOCATION word and if found, it does the replace.

Sarfraz
THX I will try itdid you read my last quastion about how to create check BOX?yael
yael
@yael: Your question is not clear there, i would simply say a check box is created like `<input type="checkbox" name="name" />`. Try to make your questions clear so that everyone understands your requirements and then you have higher chances of others responding back to you.
Sarfraz
hi again somthing is wrong with systax can U please check it again
yael
@yael: Yes, i was missing `Then` in `If` condition, fixed now.
Sarfraz