注册 登录
编程论坛 VB6论坛

如何去除由excel转出来的txt文件中的“大空格”?

ictest 发布于 2012-03-22 21:54, 1542 次点击
现有一个由excel转出来的txt文件,内部所有的空格都是“大空格”,估计是tab,我已可以读出其中所需要的一行,但是想去除其中的“大空格”,也就是说只需要字符串,但是我用了S = Replace(S, vbTab, "")语句,发现不管用,在text1.text中还是显示“大空格”,请问这是什么原因?
现将我的程序贴出,请帮我看看哪里错了,谢谢。
附件为需要读的11.txt文件
只有本站会员才能查看附件,请 登录

Private Sub Command1_Click()
Open "c:\11.txt" For Input As #1
Dim S As String
S = Replace(S, vbTab, " ")
Do While Not EOF(1)
Line Input #1, S
If InStr(S, Label1.Caption) <> 0 Then
Label3.Caption = Right(S, 315)
Text1.Text = S
Exit Do
End If
Loop
Close
End Sub

Private Sub Form_Load()
Label1.Caption = "Bin1"
End Sub
 再增加一个附件为我编写的程序
只有本站会员才能查看附件,请 登录


[ 本帖最后由 ictest 于 2012-3-22 21:56 编辑 ]
2 回复
#2
apple00720112012-03-23 09:07
程序代码:
Private Sub Command1_Click()
Open "c:\11.txt" For Input As #1
Dim S As String
'S = Replace(S, vbTab, " ")
Do While Not EOF(1)
Line Input #1, S
S = Replace(S, vbTab, " ")
If InStr(S, Label1.Caption) <> 0 Then
Label3.Caption = Right(S, 315)
Text1.Text = S
Exit Do
End If
Loop
Close
End Sub
#3
ictest2015-10-20 19:25
谢谢您的帮助!
1