Open CommonDialog1.File For Input As #1
I = 0
Do Until EOF(1)
Line Input #1, Strs
I = I + 1
Loop
Close #1
MsgBox "站数是:" & I - 3这段代码只能计算一个文件有几行
我想把已经在(filelistbox)文件列表中的文件全部都计算出来要怎么写呢
Open Replace(File1.Path & "\" & File1.List(I), "\\", "\") For Input As #1
解决方案 »
- 控件转移到桌面后,如何隐藏任务栏图标?
- 无分请教关于字符串的问题[没分了请原谅]
- 双倍送分,如何让msgbox对话框屏蔽所有窗口
- RGB(RED,GREEN,BULE)能返回一个LONG,那么,有没有一个函数能使一个LONG型值返回(RED,GREEN,BLUE)呢?
- 宣布 ******为不受欢迎的人(在我的帖子里)
- 关于两个不能窗体的datagrid单元格的值对比问题?
- 急急急!为什么无法将在VSFlexGrid7.0控件中改动的数据保存到数据库中?
- 关于阿ado的close问题,急盼解答,谢谢
- vb设置窗体大小的问题,
- 请问谁有Wise InstallMaster 8.14 East Language Packs 或下载URL!!
- 关于Grid++的问题
- 请教如何用MSCOMM32控件接受HEX格式字符?
Dim I As Integer, j As Integer, G As Integer
Dim fn As Long, strT As String, arr() As String
For I = 0 To File1.ListCount - 1
fn = FreeFile
Open Replace(File1.Path & "\" & File1.List(I), "\\", "\") For Input As #fn
G = 0
Do Until EOF(1)
Line Input #fn, strT
G = G + 1
Loop Close #fn
sh.cells(I + 1, 1) = G
Next I
ex.Visible = True
End Sub
Dim fn As Long, strT As String, arr() As String
For I = 0 To File1.ListCount - 1
fn = FreeFile
Open File1.Path & "\" & File1.List(I) For Input As #fn
G = 0
Do Until EOF(1)
Line Input #fn, strT
G = G + 1
Loop Close #fn
sh.cells(I + 1, 1) = G
Next I
ex.Visible = True
End Sub
当 File1.Path 为根目录时,你这句会出错的!
=======================================================回楼主: 你在2楼的代码,似乎没有什么错误呀! 如果有错误的话,最大的可能性是:G出现溢出! 要是你在运行时真的有什么错误,你不妨把具体的错误是什么、执行哪句时出错说一下,这样别人给你纠正起来就很容易。
是溢出了
我用Open File1.Path & "\" & File1.List(I) For Input As #fn 可以运行了
thank you