Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to quickly list the picture names/file names of a folder to Excel cells?

Author Sun Last modified

In this tutorial, I will provide some tricks on quickly listing all picture names or file names of a specific folder in an Excel sheet as the screenshot shown.

QUICK NAVIGATION

List picture names of a folder in Excel with VBA
List picture names or specific format file names of a folder in Excel with Filename List
Download sample file

A screenshot of listing picture names from a folder into Excel cells

List picture names of a folder in Excel with VBA

In Excel, there is no built-in function that can automatically list all picture names of a folder you choose in a cell of a sheet, but here I have a VBA code which can help you quickly solve this job.

1. In Excel, then press + keys to open Microsoft Visual Basic for Applications window.

2. In popping window, click Insert > Module to create a new Module script.

3. Copy below code and paste them to the new Module script window.

Sub PictureNametoExcel()
'UpdatebyExtendoffice 
    Dim I As Long
    Dim xRg As Range
    Dim xAddress As String
    Dim xFileName As String
    Dim xFileDlg As FileDialog
    Dim xFileDlgItem As Variant
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Select a cell to place name list:", "Kutools For Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Set xRg = xRg(1)
    xRg.Value = "Picture Name"
    With xRg.Font
    .Name = "Arial"
    .FontStyle = "Bold"
    .Size = 10
    End With
    xRg.EntireColumn.AutoFit
    Set xFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
    I = 1
    If xFileDlg.Show = -1 Then
        xFileDlgItem = xFileDlg.SelectedItems.Item(1)
        xFileName = Dir(xFileDlgItem & "\")
        Do While xFileName <> ""
            If InStr(1, xFileName, ".jpg") + InStr(1, xFileName, ".png") + InStr(1, xFileName, ".img") + InStr(1, xFileName, ".ioc") + InStr(1, xFileName, ".bmp") > 0 Then
                xRg.Offset(I).Value = xFileDlgItem & "\" & xFileName
                I = I + 1
            End If
            xFileName = Dir
        Loop
    End If
    Application.ScreenUpdating = True
End Sub

4. Press F5 key, then a dialog pops out for you to select a cell to place the picture names.
A screenshot of the folder selection dialog for listing picture names in Excel

5. Click OK to continue selecting the folder you want to list the picture names in Browse dialog.
A screenshot of the folder selection dialog for listing picture names in Excel

6. Click OK, now all picture names in the selected folder have been list in Excel.
A screenshot showing listed picture names in Excel cells

Note: In the VBA code, you can jpg/png/… in the code string If InStr(1, xFileName, ".jpg") + InStr(1, xFileName, ".png") + InStr(1, xFileName, ".img") + InStr(1, xFileName, ".ioc") + InStr(1, xFileName, ".bmp") > 0 Then to the file extension you need, for example, if you want to list file names of the file in doc format, only change the code string to If InStr(1, xFileName, ".doc") > 0 Then.

If you usually need to list one or all formats’ file names of a folder in Excel cell in your daily work, the code is complex and no easy to handle, but, with below way, you can quickly solve this job.


ot move

Do You Want To Have A Pay Raise and Much Time To Accompany With Family?

Office Tab Enhances Your Efficiency By 50% In Microsoft Office Working Right Now

Unbelievable, working at two or more documents is easier and faster than working at one.

Compareed with well-known browsers, the tabbed tool in Office Tab is more powerful and more efficient.

Reduce hundreds of mouse-clicks and keyboard typing every day for you, say goodbye to the mouse hand now.

If you usually work at multiple documents, Office Tab will be a great time-saver for you.

30-day free trial, no credit card required.

Read MoreFree Download Now


List picture names or specific format file names of a folder in Excel with Filename List

Here is a utility – Filename List in Kutools for Excel, which can

>> list all file names in all file formats of a folder in a new sheet;

>> list the file names in one or several file formats you specify to Excel;

>> list file names including subfolders and hidden files and folders to Excel.

Say Goodbye To Mouse Hand and Cervical Spondylosis Now

300 advanced tools of Kutools for Excel solve 80% Excel tasks in seconds, pull you out of the thousands of mouse-clicks.

Easily deal with 1500 working scenarios, no need to waste time for searching solutions, have much time to enjoy your life.

Improve 80% productivity for 110000+ highly effective people every day, of course including you.

No longer to be tormented by painful formulas and VBA, give your brain a rest and joyful working mood.

30-day free trial with full features, 30-day money back without reasons.

A Better Body Creates A Better Life.

After free installing Kutools for Excel, please do as below:

1. Enable the workbook you want to list the file names, then click Kutools Plus > Import/Export > Filename List.
A screenshot of Kutools Filename List option under Import/Export in Excel

2. In the Filename List dialog, firstly, click  A screenshot of folder selection button to select a folder that you want to list its file names, then you can check the checkboxes of Include files in subdirectories and Include hidden files and folders as you need.
A screenshot of Filename List dialog with subdirectory and hidden files options

3. Then select the file format you want to list the names in Files type section.

Check All files option, it will list all the file names in all the file formats in the selected folder
A screenshot of Filename List dialog with All files option
Check Common option, and select the specific file format you want to list the file names from the drop down list, then it will list all the file names of the file format you choose in the drop down list
A screenshot of Filename List dialog with Common file formats option
Check Specify option, then type the file extensions (using comma to separate them) you want to list the file names in the textbox, then it will only list the file names with the inputting file extensions in Excel
A screenshot of Filename List dialog with Specify option for file extensions

4. Choose the size unit as you need from the drop down list in File size unit section, if you want to create a link to the file names, check Create hyperlinks option.

A screenshot of selecting file size unit options in Filename List A screenshot of Create hyperlinks enabled in Filename List

5. Click Ok, a new sheet will be created to list the file names and some file information.
A screenshot of Excel with listed file names and details using Kutools Filename List

Tip: if you want to list all sheet names in Excel, you can apply Kutools for Excel’ Create List of Sheet Names utility, it will create a new sheet to list all linkable sheet names.
A gif showing how to create a list of sheet names in Excel using Kutools

Kutools for Excel:+ useful handy tools, simplifying the complicated tasks in Excel into a few clicks.


Download Sample File

sample


How To Make You Stand Out From Crowd, Easily Work And Leisurely Enjoy Life?

Kutools for Excel will averagely improve your 80% efficiency every day, make you have much time to accompany with family and have fun in life.

300 advanced tools solve 80% Excel problems, you no longer struggle to search solutions, more easily complete work.

Easily handle 1500 Excel scenarios, save at least 1 hour for you every day.

Become an Excel expert in 5 minutes, gain peoples’ recognition and opportunity for promotion.

One-click utilities handle batch processing, let you avoid thousands of mouse-clicks, say good-bye to mouse hand.

Get rid of rote memorizing formulas and complex VBA, give a rest to your brain.

110000+ high efficiency officers and 300+ world renowned companies’ choice.

Only take $39 but much worth than $4000 training of other people

30 days free trial without any limitation, full money back in 30-day without any reasons.


Recommended Productivity Tools

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

Excel Word Outlook Tabs PowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in