DMM
asked on
find and replace
Hello,
I need to open an html file and then do 'find and replace'. Can anyone tell me how I can do this?
Thanks.
I need to open an html file and then do 'find and replace'. Can anyone tell me how I can do this?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Maverick,
Thanks. I hope you can find a working example for me.
Regards
Thanks. I hope you can find a working example for me.
Regards
ASKER
Hi Maverick,'
Did u have any luck with the sample code?
--DMM
Did u have any luck with the sample code?
--DMM
not really ...... I think that the PAQ needs quite alot of work to get it going properl!
stay with it!
stay with it!
Hi DMM,
Command1 opens the Dialog Box
Command2 automatically searches and replaces the searchword in text1 with "zzzz"
So Richtextbox1 is the part which gets seached
Text1 is the search word
"zzzz" is the replace string!
If you didn't want to search Automatically you could insert a MsgBox to give you the choice!
Private Sub Command1_Click()
dlgCommonDialog.Filter = "All files(*.*)|*.*|HTML files (*.htm)|*.htm*"
dlgCommonDialog.Action = 1
RichTextBox1.filename = dlgCommonDialog.filename
End Sub
Private Sub Command2_Click()
Do
Mypos = 0
Mypos = InStr(Mypos + 1, RichTextBox1.Text, Text1.Text, 0)
If Mypos <> 0 Then
RichTextBox1.SelStart = Mypos - 1
RichTextBox1.SetFocus
RichTextBox1.SelLength = Len(Text1.Text)
RichTextBox1.SelText = "zzzz"
Else
MsgBox "Search String no found"
Exit Do
End If
Loop
End Sub
Command1 opens the Dialog Box
Command2 automatically searches and replaces the searchword in text1 with "zzzz"
So Richtextbox1 is the part which gets seached
Text1 is the search word
"zzzz" is the replace string!
If you didn't want to search Automatically you could insert a MsgBox to give you the choice!
Private Sub Command1_Click()
dlgCommonDialog.Filter = "All files(*.*)|*.*|HTML files (*.htm)|*.htm*"
dlgCommonDialog.Action = 1
RichTextBox1.filename = dlgCommonDialog.filename
End Sub
Private Sub Command2_Click()
Do
Mypos = 0
Mypos = InStr(Mypos + 1, RichTextBox1.Text, Text1.Text, 0)
If Mypos <> 0 Then
RichTextBox1.SelStart = Mypos - 1
RichTextBox1.SetFocus
RichTextBox1.SelLength = Len(Text1.Text)
RichTextBox1.SelText = "zzzz"
Else
MsgBox "Search String no found"
Exit Do
End If
Loop
End Sub
ASKER
Hi Maverick,
Thanks. Sorry I didnt get back earlier. It works fine now.
Thanks. Sorry I didnt get back earlier. It works fine now.
ASKER