मुख्य सामग्री पर जाएं

 किसी फ़ोल्डर में सभी फ़ाइल नामों को कैसे सूचीबद्ध करें और Excel में उनके लिए हाइपरलिंक कैसे बनाएं?

लेखक: ज़ियाओयांग अंतिम संशोधित: 2021-01-07

अपने दैनिक कार्य के लिए, आपको एक फ़ोल्डर से एक कार्यपत्रक में एकाधिक फ़ाइल नाम आयात करने और प्रत्येक फ़ाइल के लिए हाइपरलिंक बनाने की आवश्यकता हो सकती है ताकि फ़ाइल को जल्दी और आसानी से खोला जा सके। हो सकता है, आप फ़ाइल नामों को कॉपी और पेस्ट कर सकें और इसके लिए एक-एक करके मैन्युअल रूप से हाइपरलिंक बना सकें, लेकिन, यदि फ़ोल्डर में सैकड़ों फ़ाइलें हैं तो इससे बहुत समय बर्बाद होगा। आज, मैं इस काम से निपटने के कुछ त्वरित और दिलचस्प तरीकों के बारे में बात करूंगा।

सभी फ़ाइल नामों को एक फ़ोल्डर में सूचीबद्ध करें और VBA कोड के साथ हाइपरलिंक बनाएं

सभी फ़ाइल नामों को एक फ़ोल्डर में सूचीबद्ध करें और एक्सेल के लिए कुटूल के साथ हाइपरलिंक बनाएं


किसी फ़ोल्डर से फ़ाइलों को सूचीबद्ध करने और हाइपरलिंक बनाने के लिए, निम्नलिखित VBA कोड आपकी मदद कर सकता है।

1. परिणाम डालने के लिए एक नई वर्कशीट सक्रिय करें।

2. दबाए रखें ALT + F11 कुंजी को खोलने के लिए अनुप्रयोगों के लिए माइक्रोसॉफ्ट विज़ुअल बेसिक खिड़की.

3। क्लिक करें सम्मिलित करें > मॉड्यूल, और निम्नलिखित कोड को इसमें पेस्ट करें मॉड्यूल खिड़की।

वीबीए: सभी फ़ाइल नामों को एक फ़ोल्डर में सूचीबद्ध करें और हाइपरलिंक बनाएं

Sub Example1()
'Updateby Extendoffice
    Dim xFSO As Object 
    Dim xFolder As Object
    Dim xFile As Object
    Dim xFiDialog As FileDialog
    Dim xPath As String
    Dim I As Integer
    Set xFiDialog = Application.FileDialog(msoFileDialogFolderPicker)
    If xFiDialog.Show = -1 Then
        xPath = xFiDialog.SelectedItems(1)
    End If
    Set xFiDialog = Nothing
    If xPath = "" Then Exit Sub
    Set xFSO = CreateObject("Scripting.FileSystemObject")
    Set xFolder = xFSO.GetFolder(xPath)
    For Each xFile In xFolder.Files
        I = I + 1
        ActiveSheet.Hyperlinks.Add Cells(I, 1), xFile.Path, , , xFile.Name
    Next
End Sub

4। फिर दबायें F5 इस कोड को चलाने के लिए कुंजी, और वह फ़ोल्डर चुनें जिसमें आप फ़ाइलों को सूचीबद्ध करना चाहते हैं ब्राउज विंडो, स्क्रीनशॉट देखें:

दस्तावेज़ सूची हाइपरलिंक बनाएं 1

5. फ़ोल्डर निर्दिष्ट करने के बाद क्लिक करें OK बटन, और विशिष्ट फ़ोल्डर की सभी फ़ाइलें हाइपरलिंक के साथ सक्रिय वर्कशीट में सूचीबद्ध कर दी गई हैं, स्क्रीनशॉट देखें:

दस्तावेज़ सूची हाइपरलिंक बनाएं 2

नोट: यदि आपके विशिष्ट फ़ोल्डर में सबफ़ोल्डर हैं, तो सबफ़ोल्डर में फ़ाइलें सूचीबद्ध नहीं की जाएंगी।


किसी फ़ोल्डर और उसके सबफ़ोल्डर दोनों में सभी फ़ाइलों को सूचीबद्ध करने और प्रत्येक फ़ाइल के लिए हाइपरलिंक बनाने के लिए, एक्सेल के लिए कुटूलहै फ़ाइल नाम सूची आप पर एक उपकार हो सकता है. इस सुविधा के साथ, फ़ोल्डर और सबफ़ोल्डर में सभी फ़ाइलें कुछ विशेषताओं के साथ एक साथ सूचीबद्ध की जाएंगी, जैसे फ़ाइल नाम, फ़ाइल आकार, निर्मित समय, फ़ोल्डर युक्त इत्यादि।

एक्सेल के लिए कुटूल : 300 से अधिक उपयोगी एक्सेल ऐड-इन्स के साथ, 30 दिनों में बिना किसी सीमा के आज़माने के लिए निःशुल्क.

यदि आपने स्थापित किया है एक्सेल के लिए कुटूल, कृपया निम्नलिखित चरणों का पालन करें:

1। क्लिक करें कुटूल्स प्लस > आयात निर्यात > फ़ाइल नाम सूची, स्क्रीनशॉट देखें:

2. में फ़ाइल नाम सूची संवाद बॉक्स, कृपया निम्नलिखित कार्य करें:

(1.) क्लिक करें दस्तावेज़ सूची हाइपरलिंक बनाएं 5 उस फ़ोल्डर का चयन करने के लिए बटन जिसे आप फ़ाइल नाम सूचीबद्ध करना चाहते हैं;

(2.)चेक करें उपनिर्देशिकाओं में फ़ाइलें शामिल करें यदि आप सबफ़ोल्डर्स के भीतर फ़ाइल नाम सूचीबद्ध करना चाहते हैं, तो जांचें छुपी हुई फ़ाइलें और फ़ोल्डर्स शामिल करें यदि आप छुपी हुई फ़ाइलों को सूचीबद्ध करना चाहते हैं;

(3.) उन फ़ाइल प्रकारों को निर्दिष्ट करें जिन्हें आप ढूंढना और सूचीबद्ध करना चाहते हैं फ़ाइलें प्रकार अनुभाग;

(4.) वह फ़ाइल आकार इकाई चुनें जिसे आप प्रदर्शित करना चाहते हैं;

(5.)चेक करें हाइपरलिंक बनाएं संवाद बॉक्स के बाईं ओर नीचे।

एक्सेल के लिए अभी कुटूल डाउनलोड करें!

3। तब दबायें Ok बटन, और फ़ोल्डर तथा सबफ़ोल्डर की सभी फ़ाइलें आपकी आवश्यकतानुसार हाइपरलिंक के साथ एक नई वर्कशीट में सूचीबद्ध कर दी गई हैं, स्क्रीनशॉट देखें:

दस्तावेज़ सूची हाइपरलिंक बनाएं 6

फ़ाइल नाम सूची उपयोगिता के बारे में अधिक विवरण जानने के लिए क्लिक करें...

एक्सेल के लिए कुटूल अभी डाउनलोड करें और निःशुल्क परीक्षण करें!


एक्सेल के लिए कुटूल: 300 से अधिक उपयोगी एक्सेल ऐड-इन्स के साथ, 30 दिनों में बिना किसी सीमा के आज़माने के लिए निःशुल्क। अभी डाउनलोड करें और निःशुल्क परीक्षण करें!

संबंधित लेख:

फ़ोल्डर और सबफ़ोल्डर की सभी फ़ाइलों को वर्कशीट में कैसे सूचीबद्ध करें?

सर्वोत्तम कार्यालय उत्पादकता उपकरण

🤖 कुटूल्स एआई सहयोगी: निम्न के आधार पर डेटा विश्लेषण में क्रांति लाएं: बुद्धिमान निष्पादन   |  कोड जनरेट करें  |  कस्टम फ़ॉर्मूले बनाएं  |  डेटा का विश्लेषण करें और चार्ट बनाएं  |  कुटूल फ़ंक्शंस का आह्वान करें...
लोकप्रिय सुविधाएँ: डुप्लिकेट ढूंढें, हाइलाइट करें या पहचानें   |  रिक्त पंक्तियाँ हटाएँ   |  डेटा खोए बिना कॉलम या सेल को संयोजित करें   |   फॉर्मूला के बिना गोल ...
सुपर लुकअप: एकाधिक मानदंड VLookup    मल्टीपल वैल्यू वीलुकअप  |   अनेक शीटों में VLookup   |   फजी लुकअप ....
उन्नत ड्रॉप-डाउन सूची: शीघ्रता से ड्रॉप डाउन सूची बनाएं   |  आश्रित ड्रॉप डाउन सूची   |  बहु-चयन ड्रॉप डाउन सूची ....
स्तम्भ प्रबंधक: कॉलमों की एक विशिष्ट संख्या जोड़ें  |  कॉलम ले जाएँ  |  छिपे हुए कॉलम की दृश्यता स्थिति टॉगल करें  |  रेंज और कॉलम की तुलना करें ...
फीचर्ड फीचर्स: ग्रिड फोकस   |  डिजाइन देखें   |   बड़ा फॉर्मूला बार    कार्यपुस्तिका एवं शीट प्रबंधक   |  संसाधन लाइब्रेरी (ऑटो टेक्स्ट)   |  खजूर बीनने वाला   |  कार्यपत्रकों को संयोजित करें   |  एन्क्रिप्ट/डिक्रिप्ट सेल    सूची के अनुसार ईमेल भेजें   |  सुपर फ़िल्टर   |   विशेष फ़िल्टर (फ़िल्टर बोल्ड/इटैलिक/स्ट्राइकथ्रू...) ...
शीर्ष 15 टूलसेट12 टेक्स्ट टूल्स (पाठ जोड़ें, अक्षर हटाएँ, ...)   |   50 + चार्ट प्रकार (गैन्ट चार्ट, ...)   |   40+ प्रैक्टिकल सूत्र (जन्मदिन के आधार पर आयु की गणना करें, ...)   |   19 निवेशन टूल्स (QR कोड डालें, पथ से चित्र सम्मिलित करें, ...)   |   12 रूपांतरण टूल्स (शब्दों को संख्याएँ, मुद्रा रूपांतरण, ...)   |   7 विलय और विभाजन टूल्स (उन्नत संयोजन पंक्तियाँ, विभाजन कोशिकाओं, ...)   |   ... और अधिक

एक्सेल के लिए कुटूल के साथ अपने एक्सेल कौशल को सुपरचार्ज करें, और पहले जैसी दक्षता का अनुभव करें। एक्सेल के लिए कुटूल उत्पादकता बढ़ाने और समय बचाने के लिए 300 से अधिक उन्नत सुविधाएँ प्रदान करता है।  वह सुविधा प्राप्त करने के लिए यहां क्लिक करें जिसकी आपको सबसे अधिक आवश्यकता है...

Description


ऑफिस टैब ऑफिस में टैब्ड इंटरफ़ेस लाता है, और आपके काम को बहुत आसान बनाता है

  • Word, Excel, PowerPoint में टैब्ड संपादन और रीडिंग सक्षम करें, प्रकाशक, एक्सेस, विसियो और प्रोजेक्ट।
  • नई विंडो के बजाय एक ही विंडो के नए टैब में एकाधिक दस्तावेज़ खोलें और बनाएं।
  • आपकी उत्पादकता 50% बढ़ जाती है, और आपके लिए हर दिन सैकड़ों माउस क्लिक कम हो जाते हैं!
Comments (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How can you change cell and column location? as I have data already in column A, I would like to change the macro to be in column N
This comment was minimized by the moderator on the site
Hello, Diego,
To put the result in Column N, please apply the below code:
Sub Example1()
'Updateby Extendoffice
    Dim xFSO As Object
    Dim xFolder As Object
    Dim xFile As Object
    Dim xFiDialog As FileDialog
    Dim xPath As String
    Dim I As Integer
    Set xFiDialog = Application.FileDialog(msoFileDialogFolderPicker)
    If xFiDialog.Show = -1 Then
        xPath = xFiDialog.SelectedItems(1)
    End If
    Set xFiDialog = Nothing
    If xPath = "" Then Exit Sub
    Set xFSO = CreateObject("Scripting.FileSystemObject")
    Set xFolder = xFSO.GetFolder(xPath)
    For Each xFile In xFolder.Files
        I = I + 1
        ActiveSheet.Hyperlinks.Add Cells(I, 14), xFile.Path, , , xFile.Name
    Next
End Sub


Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hallo zusammen,

ich habe eine bescheidene Frage:
Wie kann ich Eine Liste von Dateinamen in klickbare Links umwandeln query.
Es sind hier Beispiele genannt worden. Dies hat mich aber nicht weiter gebracht.
Hat wer eine Beispieldatei? Wie aus dem Bericht #28151.

Danke!
This comment was minimized by the moderator on the site
Hello friend,

After all the files in the specific folder have been listed in the active worksheet with hyperlinks, you can click the cells to open the hyperlinks. All the filenames are clickable. Please see the screenshots.

But I can't send you my example Excel file, because those hyperlinks listed in the file can only be opened from my own computers. Just use the method to create hyperlinks with files from your specific folder. After the filenames with hyperlinks are listed in a new file. Just click the hyperlinks to open them. Please have a try.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
@skyyang Hi,
Could this code be edited to hyperlink path for files instead of folders. For example, instead of hyperlinking the paths of the folders inside Folder1, it would hyperlink the paths of all files in Folder1 (i need the text to display as the path of the file, not the file name), that would be the perfect use case for me.
appreciate any help you could offer :)
This comment was minimized by the moderator on the site
How would I change this code to have it list folder names rather than file names? And how would I change it to check subfolders for files?
This comment was minimized by the moderator on the site
Hi, Ellie,
To list all folder and subfolder names from a directory, the below VBA code can help you, please try, hopt it can help you.

Sub FolderNames()
Application.ScreenUpdating = False
Dim xPath As String
Dim xWs As Worksheet
Dim fso As Object, j As Long, folder1 As Object
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Choose the folder"
.Show
End With
On Error Resume Next
xPath = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1) & "\"
Application.Workbooks.Add
Set xWs = Application.ActiveSheet
xWs.Cells(1, 1).Value = xPath
xWs.Cells(2, 1).Resize(1, 5).Value = Array("Path", "Dir", "Name", "Date Created", "Date Last Modified")
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder1 = fso.getFolder(xPath)
getSubFolder folder1
xWs.Cells(2, 1).Resize(1, 5).Interior.Color = 65535
xWs.Cells(2, 1).Resize(1, 5).EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
Sub getSubFolder(ByRef prntfld As Object)
Dim SubFolder As Object
Dim subfld As Object
Dim xRow As Long
For Each SubFolder In prntfld.SubFolders
xRow = Range("A1").End(xlDown).Row + 1
Cells(xRow, 1).Resize(1, 5).Value = Array(SubFolder.Path, Left(SubFolder.Path, InStrRev(SubFolder.Path, "\")), SubFolder.Name, SubFolder.DateCreated, SubFolder.DateLastModified)
Next SubFolder
For Each subfld In prntfld.SubFolders
getSubFolder subfld
Next subfld
End Sub
This comment was minimized by the moderator on the site
How would you code this to make hyperlinks for path and directory
This comment was minimized by the moderator on the site
Hi, yuri,
To solve your problem, please try the following code:

Sub FolderNames()
Application.ScreenUpdating = False
Dim xPath As String
Dim xWs As Worksheet
Dim xRg As Range
Dim fso As Object, j As Long, folder1 As Object
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Choose the folder"
.Show
End With
On Error Resume Next
xPath = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1) & "\"
Application.Workbooks.Add
Set xWs = Application.ActiveSheet
Set xRg = xWs.Cells(1, 1)
xRg.Value = xPath
xWs.Hyperlinks.Add Anchor:=xRg, Address:=xPath, TextToDisplay:=xPath
xWs.Cells(2, 1).Resize(1, 5).Value = Array("Path", "Dir", "Name", "Date Created", "Date Last Modified")
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder1 = fso.GetFolder(xPath)
getSubFolder folder1
xWs.Cells(2, 1).Resize(1, 5).Interior.Color = 65535
xWs.Cells(2, 1).Resize(1, 5).EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
Sub getSubFolder(ByRef prntfld As Object)
Dim SubFolder As Object
Dim subfld As Object
Dim xRow As Long
Dim xStr As String
Dim xRg As Range
For Each SubFolder In prntfld.SubFolders
xRow = Range("A1").End(xlDown).Row + 1
Cells(xRow, 1).Resize(1, 5).Value = Array(SubFolder.Path, Left(SubFolder.Path, InStrRev(SubFolder.Path, "\")), SubFolder.Name, SubFolder.DateCreated, SubFolder.DateLastModified)
Set xRg = Cells(xRow, 1)
xRg.Worksheet.Hyperlinks.Add Anchor:=xRg, Address:=xRg.Value, TextToDisplay:=xRg.Value
Set xRg = Cells(xRow, 2)
xRg.Worksheet.Hyperlinks.Add Anchor:=xRg, Address:=xRg.Value, TextToDisplay:=xRg.Value
Next SubFolder
For Each subfld In prntfld.SubFolders
getSubFolder subfld
Next subfld
End Sub
This comment was minimized by the moderator on the site
How do you display also the files. Not just folders and subfolders?
This comment was minimized by the moderator on the site
Hello, isabel,
To list file folder and file names, the following code may help you:
Option Explicit
Sub ListFoldersAndFilesWithDialog()
    Dim fso As Object
    Dim mainFolder As Object
    Dim ws As Worksheet
    Dim rowIndex As Long
    Dim folderPath As String
    ' Open folder picker dialog to select main folder path
    With Application.FileDialog(msoFileDialogFolderPicker)
        If .Show = -1 Then
            folderPath = .SelectedItems(1)
        Else
            Exit Sub
        End If
    End With
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set mainFolder = fso.GetFolder(folderPath) 
    On Error Resume Next
    Set ws = ThisWorkbook.Sheets("FolderList")
    On Error GoTo 0  
    If ws Is Nothing Then
        Set ws = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))
        ws.Name = "FolderList"
    End If
    ws.Cells.Clear
    rowIndex = 1
    ws.Cells(rowIndex, 1).Value = "Folder Name"
    ws.Cells(rowIndex, 2).Value = "File Name"
    ListFilesInFolder mainFolder, ws, rowIndex + 1
End Sub

Sub ListFilesInFolder(ByVal folder As Object, ByVal ws As Worksheet, ByRef rowIndex As Long)
    Dim file As Object
    Dim subFolder As Object
    Dim linkAddress As String  
    For Each file In folder.Files
        ws.Cells(rowIndex, 1).Value = folder.Name
        ws.Cells(rowIndex, 2).Value = file.Name
        linkAddress = file.Path
        ws.Hyperlinks.Add Anchor:=ws.Cells(rowIndex, 2), Address:=linkAddress
        rowIndex = rowIndex + 1
    Next file
    
    For Each subFolder In folder.SubFolders
        ListFilesInSubFolder subFolder, ws, rowIndex
    Next subFolder
End Sub

Sub ListFilesInSubFolder(ByVal subFolder As Object, ByVal ws As Worksheet, ByRef rowIndex As Long)
    Dim file As Object
    Dim linkAddress As String 
    For Each file In subFolder.Files
        ws.Cells(rowIndex, 1).Value = subFolder.Name
        ws.Cells(rowIndex, 2).Value = file.Name
        linkAddress = file.Path
        ws.Hyperlinks.Add Anchor:=ws.Cells(rowIndex, 2), Address:=linkAddress
        rowIndex = rowIndex + 1
    Next file
    Dim subSubFolder As Object
    For Each subSubFolder In subFolder.SubFolders
        ListFilesInSubFolder subSubFolder, ws, rowIndex
    Next subSubFolder
End Sub


After copying and pasting the code, please click Tools > References, and then choose Microsoft Scripting Runtime from the Reference-VBAproject dialog box.
https://cdn.extendoffice.com/images/stories/comments/comment-skyyang/2023-comment/doc-list-files.png

And then, run the code.

Also, you can use our Kutools for Excel's Filename List feature to solve this job quickly and easily.


Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
@skyyang Hi,
Could this code be edited to hyperlink path for files instead of folders. For example, instead of hyperlinking the paths of the folders inside Folder1, it would hyperlink the paths of all files in Folder1 (i need the text to display as the path of the file, not the file name), that would be the perfect use case for me.
appreciate any help you could offer :)
This comment was minimized by the moderator on the site
@skyyang Hi,Could this code be edited to hyperlink path for files instead of folders. For example, instead of hyperlinking the paths of the folders inside Folder1, it would hyperlink the paths of all files in Folder1 (i need the text to display as the path of the file, not the file name), that would be the perfect use case for me. appreciate any help you could offer :)
This comment was minimized by the moderator on the site
"VBA: List all filenames in a folder and create hyperlinks" is great! It works perfectly! Thank you for posting! One question... Now that you told us how to add links from folder, is it possible to use those links to get information from say one or two different sheets in each of the files listed? They would be the same cells for each of the files we now have a list for. This would help create a comprehensive contents with active links to otherwise unintelligible file names.
This comment was minimized by the moderator on the site
Great thanks although can not view the files in the selected directory as barry said, it creates hyperlinks for all files in that directory anyway.
This comment was minimized by the moderator on the site
Awesome ..thanks a lot. It really saved my time.
This comment was minimized by the moderator on the site
Running the VBA code listed above, shows the selected directory is empty, when it is full of Excel files.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations