请教:运行出现“实时错误55,文件已打开
--------------------编程问答--------------------
不好意思,多发了,不知道怎么删除
--------------------编程问答--------------------
给你整理了下。
Private Sub Cmdzhuaqu_Click()
Dim a$, m%, n%, b$, c$, d$, a1$, a2$
'检测txt文件内有多少条记录
Open Txtlujing.Text For Input As #1
m = 0
While Not EOF(1)
Input #1, a
m = m + 1
Wend
Close #1
b = "0"
Open Txtlujing.Text For Input As #1
Dim strPath$, strFileName$, strTmp$
For n = 1 To m
Line Input #1, a
Call trim(a$, a1$)
If a1 <> b Then
b = a1
strPath = App.Path & "\" '当前目录
strTmp = b & "01.Txt" '文件名称
strFileName = strPath & strTmp '指定路径名称
Open strFileName For Output As #2
Print #2, a
Close #2
Else
Open strFileName For Append As #2
Print #2, a ' "这里写入文件内容"
Close #2
End If
Next n
Close #1
End Sub
--------------------编程问答--------------------
GoTo 10 以及if的for循环的嵌套注意检查一下。
补充:VB , 基础类