这个的操作和在VB中一样啊dim fninput as long dim fnoutput as long dim strLine as stringfninput=freefile open infile for input as fninput fnoutput=freefile open outfile for output as fnoutputdo while not eof(fninput) line input #fninput,strLine '按照需要处理你的内容 print #fnoutput, strLine loopclose #fninput close #fnoutput
Dim strA As String Dim strTemp As String strA = '11112222' strTemp = strA Dim strB As String strTemp = Replace(strTemp, '1', 'A') strTemp = Replace(strTemp, '2', 'B')'VB.Net中使用String类的Replace方法 'strTemp.Replace('1', 'A') 'strTemp.Replace('2', 'B')strB = strTemp
dim fnoutput as long
dim strLine as stringfninput=freefile
open infile for input as fninput
fnoutput=freefile
open outfile for output as fnoutputdo while not eof(fninput)
line input #fninput,strLine
'按照需要处理你的内容
print #fnoutput, strLine
loopclose #fninput
close #fnoutput
Dim strTemp As String
strA = '11112222'
strTemp = strA
Dim strB As String
strTemp = Replace(strTemp, '1', 'A')
strTemp = Replace(strTemp, '2', 'B')'VB.Net中使用String类的Replace方法
'strTemp.Replace('1', 'A')
'strTemp.Replace('2', 'B')strB = strTemp
"C:\Documents and Settings\Administrator\桌面\新建文件夹 (9)\g2.txt", Origin:=936, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True
Cells.Replace What:="111222", Replacement:="AAABBB", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Administrator\桌面\新建文件夹 (9)\g2.txt", FileFormat:= _
xlText, CreateBackup:=False
LZ可以这样,用excel打开你的文本文件,再录制宏进行替换,最后保存成txt文件
也能实现你的效果.....