两个函数的代码,请帮助解释一下意思和用法。如果我要在TreeView控件里面使用这两个函数,改如何修改里面的代码。 谢谢。在线等候了!!! Public Function M_Number(Field As String) As String '自动创建多层目录 Field_len = Len(Field) Start = 4 Number = InStr(Start, Field, "\") Do While Number > 0 Or Start < Field_len If Number > 0 Then Text = Left(Field, Number - 1) Start = Number + 1 Else Text = Field Start = Field_len End If Number = InStr(Start, Field, "\") If Dir(Text, 30) = "" Then MkDir Text Else If (GetAttr(Text) And vbDirectory) <> vbDirectory Then MkDir Text End If Loop End Function Public Function FileDir(ByVal Path$) '列出指定目录下的所有文件 Dim vDirName As String, LastDir As String, FullName As String If Right(Path$, 1) <> "\" Then Path$ = Path$ & "\" vDirName = Dir(Path$, 55) Do While Not vDirName = "" If vDirName <> "." And vDirName <> ".." Then FullName = Path$ & vDirName If (GetAttr(FullName) And vbDirectory) = vbDirectory Then LastDir = vDirName Call FileDir(FullName) vDirName = Dir(Path$, 55) Do Until vDirName = LastDir Or vDirName = "" vDirName = Dir(, 55) Loop If vDirName = "" Then Exit Do Else For s = 1 To 20 ActiveSheet.Cells(s, 1).Value = FullName If s = 20 Then Exit For Next End If End If vDirName = Dir(, 55) Loop End Function |