Sub fileName(Fname, Fpath, gsF, gsRep) Dim gsString As String Open Fpath & Fname For Input As #1 Open Fpath & "new" & Fname For Output As #2 Do While Not EOF(1) Input #1, gsString Call Replace(gsString, gsF, gsRep) Print #2, gsString Loop Close #1, #2 Call FileCopy(Fpath & "new" & Fname, Fpath & Fname) Kill Fpath & "new" & Fname End Sub
Text.Find(TextFind.Text, Text.SelStart +Text.SelLength) 可一实现
查找功能。
RichText.SelText = TextReplace.Text 这是替换。
Dim gsString As String
Open Fpath & Fname For Input As #1
Open Fpath & "new" & Fname For Output As #2
Do While Not EOF(1)
Input #1, gsString
Call Replace(gsString, gsF, gsRep)
Print #2, gsString
Loop
Close #1, #2
Call FileCopy(Fpath & "new" & Fname, Fpath & Fname)
Kill Fpath & "new" & Fname
End Sub
可以这样
call fileName(Fname, Fpath,chr(asc(")) ,chr(asc(')))