|
- Sub l()
- Dim brr(), arr()
- Dim i%, n%
- Dim Mypath$, Myname$, sh As Worksheet
- Mypath = ThisWorkbook.Path & ""
- Myname = Dir(Mypath & "*.xls*")
- Application.ScreenUpdating = False
- Do While Myname <> ""
- If Myname <> ThisWorkbook.Name Then
- With GetObject(Mypath & Myname)
- For Each sh In .Sheets
- If Application.WorksheetFunction.CountA(sh.Cells) > 0 Then
- n = n + 1
- ReDim Preserve arr(1 To n)
- ReDim Preserve brr(1 To n)
- arr(n) = Mypath & Myname & "#" & sh.Name & "!A1"
- brr(n) = sh.Name
- End If
- Next
- .Close False
- End With
- End If
- Myname = Dir
- Loop
- Sheet1.Columns("a:A").Clear
- For i = 1 To n
- Sheet1.Hyperlinks.Add Range("a" & i), arr(i), , , brr(i)
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|