|
Sub hyperlinkadd()
dim fso,fd as object
dim n,m as long
Dim ar() As Variant
Set fso = CreateObject("scripting.filesystemobject")
wb = ActiveWorkbook.Path
Set fd = fso.getfolder(wb & "\" & 2019)
ReDim ar(fd.Files.Count - 1)
s = 0
For Each xl In fd.Files
ar(s) = xl.Name
s = s + 1
Next
For m = 0 To UBound(ar)
Set sh = GetObject(wb & "\" & 2019 & "\" & ar(m))
For n = 0 To UBound(ar)
If ar(n) <> sh.Name Then
For Each sht In sh.Sheets
r = sh.Sheets(sht.Name).Range("iv1").End(xlToLeft).Column
sh.Sheets(sht.Name).Hyperlinks.Add Anchor:=sh.Sheets(sht.Name).Cells(1, r + 1), Address:=wb & "\" & 2019 & "\" & ar(n), _
TextToDisplay:=fso.getfilename(wb & "\" & 2019 & "\" & ar(n))
Next
End If
Next n
Application.DisplayAlerts = False
Application.Windows(sh.Name).Visible = True
sh.Save
sh.Close
Next m
set fso=nothing
MsgBox "ok"
End Sub
|
评分
-
1
查看全部评分
-
|