
VB 修改txt内容`十万火急
PrivateSubCommand6_Click()DimtxtAsStringOpen"C:\DocumentsandSettings\Administrator\桌面...
Private Sub Command6_Click()
Dim txt As String
Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1
Open "C:\Documents and Settings\Administrator\桌面\feix.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, txt
If txt = "888888001" Then txt= & Text1.Text "001
Print #2, txt
Loop
Close
End Sub
为什么显示 & 没有表达式 ??表达式怎么写?
我的txt文件的内容
888888001
888888002
...
我想把888888 通过Text2的输入然后全部修改。后面的001~999不变。
很急!!谢谢了。
楼下的非常谢谢你,但是你的代码Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1这里有错。不能修改啊`能再看看下吗? 展开
Dim txt As String
Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1
Open "C:\Documents and Settings\Administrator\桌面\feix.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, txt
If txt = "888888001" Then txt= & Text1.Text "001
Print #2, txt
Loop
Close
End Sub
为什么显示 & 没有表达式 ??表达式怎么写?
我的txt文件的内容
888888001
888888002
...
我想把888888 通过Text2的输入然后全部修改。后面的001~999不变。
很急!!谢谢了。
楼下的非常谢谢你,但是你的代码Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1这里有错。不能修改啊`能再看看下吗? 展开
2个回答
展开全部
改为这样:
Private Sub Command6_Click()
Dim txt As String
Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1
Open "C:\Documents and Settings\Administrator\桌面\feix.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, txt
If left(txt,6) = "888888" and len(txt)=9 Then
txt= Text1.Text & right(txt,3)
Print #2, txt
end if
Loop
Close #1
close #2
End Sub
Private Sub Command6_Click()
Dim txt As String
Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1
Open "C:\Documents and Settings\Administrator\桌面\feix.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, txt
If left(txt,6) = "888888" and len(txt)=9 Then
txt= Text1.Text & right(txt,3)
Print #2, txt
end if
Loop
Close #1
close #2
End Sub
展开全部
Private Sub Command6_Click()
Dim txt As String
Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, txt
If left(txt,6) = "888888" and len(txt)=9 Then txt= txt & Text1.Text & right(txt,3) & vbcrlf
Loop
Close #1
Open "C:\Documents and Settings\Administrator\桌面\feix.txt" For Output As #2
print #2,txt
close #2
End Sub
Dim txt As String
Open "C:\Documents and Settings\Administrator\桌面\yuanshi.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, txt
If left(txt,6) = "888888" and len(txt)=9 Then txt= txt & Text1.Text & right(txt,3) & vbcrlf
Loop
Close #1
Open "C:\Documents and Settings\Administrator\桌面\feix.txt" For Output As #2
print #2,txt
close #2
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询