そのため、今日、コードをハイパーリンクに修正しましたが、リストを列 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 に移動するのを手伝ってくれる人はいますか?