NYG Irving
05-04-2023, 04:35 PM
This will do:
Sub M_snb()
With Application.FileDialog(4)
If .Show Then sn = Split(CreateObject("wscript.shell").exec("cmd /c dir """ & .SelectedItems(1) & "\*.*"" /a-d /b /s").stdout.readall, vbCrLf)
End With
For Each it In sn
ActiveSheet.Hyperlinks.Add Cells(Rows.Count, 1).End(xlUp).Offset(1), it
Next
End Sub
Thank you for sharing this code. It is great. Is it possible to modify it so that in the text which is displayed for each hyperlink it is just the name of the document without the folder and subfolder of the filepath address? Thank you for any assistance you can offer.
Sub M_snb()
With Application.FileDialog(4)
If .Show Then sn = Split(CreateObject("wscript.shell").exec("cmd /c dir """ & .SelectedItems(1) & "\*.*"" /a-d /b /s").stdout.readall, vbCrLf)
End With
For Each it In sn
ActiveSheet.Hyperlinks.Add Cells(Rows.Count, 1).End(xlUp).Offset(1), it
Next
End Sub
Thank you for sharing this code. It is great. Is it possible to modify it so that in the text which is displayed for each hyperlink it is just the name of the document without the folder and subfolder of the filepath address? Thank you for any assistance you can offer.