오늘 코드를 하이퍼 링크로 고정 시켰지만 열 A 대신 열 U에 목록을 넣는 방법을 알아낼 수 없습니다.디렉터리 목록 하이퍼 링크 매크로를 다른 열로 이동해야합니다.
Sub hyperlinker()
Dim MOG As Object
Dim rsMOG As Object
Dim PrimeF As Object
Dim Bit As Object
Dim Foder As Object
Dim Linger As Integer
Dim Enigma As String
Dim Way As String
'Get the current folder
Set MOG = CreateObject("scripting.filesystemobject")
Set PrimeF = MOG.GetFolder(ThisWorkbook.Path)
Set MOG = Nothing
'Get the row at which to insert
Linger = Range("A65536").End(xlUp).row + 1
'Create the recordset for sorting
Set rsMOG = CreateObject("ADODB.Recordset")
With rsMOG.Fields
.Append "Way", 200, 200
.Append "Enigma", 200, 200
.Append "Bit", 200, 200
End With
rsMOG.Open
' Traverse the entire folder tree
TraverseFolderTree PrimeF, PrimeF, rsMOG
Set PrimeF = Nothing
'Sort by type and name
rsMOG.Sort = "Bit ASC, Enigma ASC "
rsMOG.MoveFirst
'Populate the first column of the sheet
While Not rsMOG.EOF
Enigma = rsMOG("Enigma").value
Way = rsMOG("Way").value
If (Enigma <> ThisWorkbook.name) Then
ActiveSheet.Hyperlinks.Add Anchor:=Cells(Linger, 1), Address:=Way, TextToDisplay:=Enigma
Linger = Linger + 1
End If
rsMOG.MoveNext
Wend
'Close the recordset
rsMOG.Close
Set rsMOG = Nothing
End Sub
Private Sub TraverseFolderTree(ByVal parent As Object, ByVal node As Object, ByRef rs As Object)
'List all files
For Each Bit In node.Files
Dim Enigma As String
Enigma = Mid(Bit.Path, Len(parent.Path) + 2)
rs.AddNew
rs("Way") = Way
rs("Enigma") = Enigma
rs("Bit") = "Bit"
rs.Update
Next
'List all folders
For Each Foder In node.SubFolders
TraverseFolderTree parent, Foder, rs
Next
End Sub
철자 색인에있는 임의의 단어를 다른 매크로에서 일반적인 단어를 사용하기 때문에 이상한 이름으로 변경해야했습니다. 기본적으로
,
dim linger as integer
및
'Get the row at which to insert
Linger = Range("A65536").End(xlUp).row + 1
가 열 A에게 나에게 내가 거기에 넣어 무슨 이잖아요주지, 사람이 열 U이 하이퍼 링크 목록을 얻을하는 데 도움이 수 있습니까?
여기에 내가 마지막으로 대답하는 링크가 있습니다. 내 매크로를 수정하여 디렉토리 목록을 하이퍼 링크로 연결하십시오. http://exackoverflow.com/questions/19148596/excel-macro-listing-all-files-within-the-contained-directory-and-hyperlinking-th –