|
楼主 |
发表于 2024-8-4 08:31
|
显示全部楼层
没办法只能遍历所有Sheet
- Sub dedelll()
- Dim Fso As FileSystemObject, oFile As File
- Set Fso = New FileSystemObject
- Dim Rng As Range
- Dim Shts As Worksheets
- 'Set Shts = Application.ActiveWorkbook
- Dim Sht As Worksheet
- Set Sht = Application.ActiveSheet
- For Each Sht In Sheets
- If Sht.Name <> "Menu" Then
- Sht.Activate
- Set Rng = Sht.Cells(10, "Z").CurrentRegion
- Debug.Print Rng.Address, Rng.Parent.Name
- For ii = 1 To Rng.Rows.Count
- If Not IsNull(Rng(ii, 1)) Then
- Debug.Print Rng(ii, 1), Rng.Address, Rng.Parent.Name
- Set oFile = Fso.GetFile(Rng(ii, 1).Value)
- Rng(ii, 1).Select
- Sht.Hyperlinks.Add Anchor:=Selection, Address:=oFile.Path, TextToDisplay:=oFile.Path
- End If
- Next ii
- End If
- Next Sht
- End Sub
复制代码 |
|