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这里有错。不能修改啊`能再看看下吗?
展开
 我来答
网海1书生
科技发烧友

2010-01-13 · 擅长软件设计、WEB应用开发、小程序
网海1书生
采纳数:12315 获赞数:26235

向TA提问 私信TA
展开全部
改为这样:

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
在世贸天阶灌篮的高飞燕草
2010-01-13 · TA获得超过2380个赞
知道大有可为答主
回答量:2070
采纳率:0%
帮助的人:2077万
展开全部
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
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式