Option Explicit
' Purpose:
' Author:吴文智
' Date:2001-11-12
'Description:要试用本例请在窗体中填加一个按钮
' 然后在代码窗体中粘贴如下代码
' Good luck!Private Sub Command1_Click()
Dim strText As String
Open "test.txt" For Input As #1
'因为你确定只有一行,所以此处省略了DO LOOP循环
Line Input #1, strText
Close #1
Replace strText, "b", "c"
Open "test.txt" For Output As #2
Print #2, strText
Close #2
MsgBox "替换完成.", vbInformation
End Sub
' Purpose:
' Author:吴文智
' Date:2001-11-12
'Description:要试用本例请在窗体中填加一个按钮
' 然后在代码窗体中粘贴如下代码
' Good luck!Private Sub Command1_Click()
Dim strText As String
Open "test.txt" For Input As #1
'因为你确定只有一行,所以此处省略了DO LOOP循环
Line Input #1, strText
Close #1
Replace strText, "b", "c"
Open "test.txt" For Output As #2
Print #2, strText
Close #2
MsgBox "替换完成.", vbInformation
End Sub
Replace(expression, find, replacewith[, start[, count[, compare]]])
在这句话改成你变量对应的字符串就行了
比如:a是sss,b是kkk
就改成
Replace strText, "sss", "kkk"