请给下面程序中的 FindFile = FindFile + FindFile(tFld.Path, sFile)这一句加上说明,谢谢。

OptionExplicitDimfsoAsNewFileSystemObjectDimfldAsFolderPrivateSubCommand1_Click()Me.M... Option Explicit

Dim fso As New FileSystemObject
Dim fld As Folder

Private Sub Command1_Click()
Me.MousePointer = vbHourglass
Command1.Enabled = False
Text1.Enabled = False
Text2 = ""
FindFile Dir1.Path, Text1
Text2 = Text2 & vbCrLf & "Search complete"
Text2.SelStart = Len(Text2)
Command1.Enabled = True
Text1.Enabled = True
Me.MousePointer = vbDefault

End Sub
Private Function FindFile(ByVal sFol As String, sFile As String) As Long
Dim tFld As Folder, tFil As File, FileName As String

Set fld = fso.GetFolder(sFol)
For Each tFil In fld.Files
If Mid(tFil.Name, InStrRev(tFil.Name, ".") + 1) = Text1 Then _
Text2 = Text2 & fso.BuildPath(fld.Path, tFil.Name) & vbCrLf
Text2.SelStart = Len(Text2)
DoEvents
Next

If fld.SubFolders.Count > 0 Then
For Each tFld In fld.SubFolders
DoEvents
FindFile = FindFile + FindFile(tFld.Path, sFile)
Next
End If
End Function

Private Sub Drive1_Change()
Dim sDir As String

sDir = Drive1.Drive
If InStr(sDir, "\\") <> 0 Then
sDir = Trim(Mid(sDir, InStr(sDir, "\\")))
If InStr(sDir, "]") <> 0 Then sDir = Left(sDir, InStr(sDir, "]") - 1)
ElseIf InStr(sDir, "[") <> 0 Then
sDir = Trim(Left(sDir, InStr(sDir, "[") - 1))
End If
If Right(sDir, 1) <> "\" Then sDir = sDir & "\"
Dir1.Path = sDir

End Sub

Private Sub Form_Load()
Drive1_Change

End Sub

Private Sub Form_Unload(Cancel As Integer)
End
End Sub
展开
 我来答
百度网友dd3335d
2011-04-23 · TA获得超过216个赞
知道小有建树答主
回答量:139
采纳率:0%
帮助的人:61.2万
展开全部
'递归调用FindFile,直到 fld.SubFolders.Count 等于0为止。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式