|
原帖由 zhongcai 于 2010-3-22 09:40 发表
具体在附件里面
┣数学
┃ ┣第一章 集合
┃ ┃ ┣ 1.1集合的含义及其表示.doc
┃ ┃ ┣ 1.2子集、全集、补集.doc
┃ ┃ ┣ 1.3交集、并集.doc
┃ ┣第二章 函数概念与基本初等 ...
请测试:
Sub Macro1()
Dim mypath$, mydir$, arr() As String, a, MyFilename$, i&, m&, n&, s1$, s2$
s1 = "┃ ┣"
s2 = "┃ ┃ ┣"
mypath = ThisWorkbook.Path & "\"
mydir = Dir(mypath & "*", vbDirectory)
While mydir > ""
If Not mydir Like ".*" And GetAttr(mypath & mydir) = vbDirectory Then
n = n + 1
ReDim Preserve arr(1 To n)
arr(n) = mypath & mydir
End If
mydir = Dir()
Wend
m = 1
Application.ScreenUpdating = False
With ActiveSheet
.[A1].CurrentRegion.Offset(1, 0).Clear
For i = 1 To n
m = m + 1
a = Split(arr(i), "\")
.Cells(m, 1) = s1 & a(UBound(a))
MyFilename = Dir(arr(i) & "\*.*")
Do While MyFilename <> ""
m = m + 1
.Hyperlinks.Add Anchor:=.Cells(m, 1), Address:=arr(i) & "\" & MyFilename, TextToDisplay:=s2 & Replace(MyFilename, "?", "")
MyFilename = Dir
Loop
Next
End With
Application.ScreenUpdating = True
End Sub |
|