Generating Automatic Links to Audio Files

by Allen Wyatt
(last updated February 11, 2019)


Clive is a birdwatcher and has over 300 MP3 files of bird sounds. He wants to create an Excel worksheet with a single column in which is listed the actual names of the MP3 files, e.g "cormorant.mp3". He wants to create a hyperlink from each of these 300 or so cells to the physical MP3 file, such that the player will open and play the bird sound. He knows that he can individually insert the hyperlink, but that would obviously be quite tedious. So he wonders if there is a way to automatically create such a link based on the MP3 file names in the worksheet.

This question actually has two parts: Getting the file names into an Excel worksheet and then creating a link to the MP3 file so the birdsong can be played.

Start by making sure that all the MP3 files are in the same folder on your hard drive. How you can grab a listing of files has been covered in other issues of ExcelTips; you may want to review the ideas of how to do this, found at this ExcelTips page:

Once the names are in the worksheet (let's assume they are in column A), you can easily use the HYPERLINK worksheet function to put together the actual link. For example, you could place the following in cell B1:

=HYPERLINK("C:\Documents\Birdsongs\" & A1)

This assumes that the folder in which the songs are located is C:\Documents\Birdsongs\. If the path is actually different, just make the change in the HYPERLINK function.

Once the correct formula is in cell B1, you can then copy it down for however many cells you require to get all the correct hyperlinks.

Of course, you can specify the "display text" to be utilized by the HYPERLINK function. If your birdsong files start with the bird's name and end with .mp3, you could add the display text to the HYPERLINK function in this manner:

=HYPERLINK("C:\Documents\Birdsongs\" & A1, LEFT(A1, LEN(A1) - 4)

This usage simply strips off the last four characters (the period and "mp3") from the file name and then uses that as the display text.

If you want to use a macro approach to actually creating hyperlinks (without using the HYPERLINK function), then a good place to start is with the filename-grabbing macro from the tip referred to earlier in this tip. It can be modified to put not only the filenames into the worksheet, but also to create the requisite hyperlinks:

Sub MakeHyperlinks()
    Dim sPath As String
    Dim sFile As String
    Dim iRow As Integer

    'specify directory to use - must end in "\"
    sPath = "C:\Documents\Birdsongs\"

    iRow = 0
    sFile = Dir(sPath)
    While sFile <> ""
        iRow = iRow + 1
        Sheet1.Cells(iRow,1) = sFile
        sBird = Left(sFile, Len(sFile)-4)
        ActiveSheet.Hyperlinks.Add Anchor:=Sheet1.Cells(iRow,1), _
          Address:=sPath & sFile, TextToDisplay:=sBird
        sFile = Dir     ' Get next filename
End Sub

If you decide to go the macro route, make sure there is nothing in the current worksheet. The macro runs very quickly and wipes out anything that is in the cells to which it writes. When it is done, you end up with the filename in column A and a hyperlink to the MP3 file in column B.

When you click on a hyperlink in the worksheet, Excel launches your Web browser and loads the MP3 file. The browser then plays the file.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13127) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Opening a Word Document when Starting the Computer

Some people use their computers for little else, other than to work on Word documents. If that is the case with you, then ...

Discover More

Identifying Scatter Plot Points

Do you want to add data labels to the data points in an xy graph? Excel doesn't provide a way to get the desired labels, ...

Discover More

Inconsistent Formatting in an Index

When indexing a document, you may find that some of your index entries aren't formatted the save as your other index ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Removing Hyperlinks without a Macro, Take Two

Need to get rid of hyperlinks in a worksheet? Here's an easy way to do it without using a macro.

Discover More

Tying a Hyperlink to a Specific Cell

Make a hyperlink to a cell in your workbook, edit the structure of that workbook a bit, and you may find that the ...

Discover More

Changing Portions of Many Hyperlinks

If you need to modify the URL used in a large number of hyperlinks, you can do so by using a macro and a little ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 5?

2019-08-10 05:53:36


This is a very good programm idea. However, if Clive wants to use his bird songs in an Excel quiz, opening the browser or iTunes by activating the link might not be helpful. I know about a function in Excel you can play wav files with. One could transform all mp3's into wav's. This however requires more space and some time to transfer all the files. I'm at the stage to use free wav-mp3 converter and can play the wav files (or parts of them) but ideally I'd like to activate a player (not visible) playing directly the mp3 file for which the link or the path and name are in a certain cell. Do you have any solution for this,

2017-12-06 13:39:36


My files are all stored in Google Drive. How can I write a macro to go find the file name on the google drive and create a link to it in my excel file?

2015-03-11 13:56:28

Tim Constable

P.S. I've just discovered that MP3 filesnames pasted into Excel (I was using it for WAVs) DO open in a player, such as Quick Time.

2015-03-11 13:53:15

Tim Constable

I was looking into doing a similar thing (I'm a songwriter, and wanted a more organised way of accessing my music, scattered in various folders). Using Excel Office 2007 version, I found the following worked:

1) In Explorer, navigate to the folder with the audio files you want listing. Make sure the full path is visible in the address bar.
2) Click in the address bar (the whole path should be highlighted), and right-click copy (or Ctrl-C)
3) Open a a new tab in a browser (I've found this works in SeaMonkey and Google Chrome, but not in IE [surprise surprise!!]). Paste the address into the address window, and it should show the file listing complete with a link to a higher directory/folder. Each of the filesnames is a hyperlink which plays the file! You can use the back button to return to the listing.

4)If you really need the listing in an office document, highlight the file listing and copy it, you can paste it into Excel or Word. In Excel, all the hyperlinks copy across! You can click on the filename and it plays - the only problem is that it seems to play in an 'invisible' player, and you can't get to control it or stop it!! I found I could stop it by pressing any of the navigator keys or the mouse wheel, SO LONG AS I DIDN'T CLICK INTO ANOTHER CELL!The play can also be stopped by opening Task Manager and ending a Process called sndrec32.exe; you can right click and end process tree!

2014-06-09 05:45:01


Although a nice intellectual exercise; wouldn't one of the many music players be a better solution? Many players are free including Windows Media Player bundled free with every Windows installation.

Using tags you can then create 'playlists' for different types of bird.

2014-06-08 11:06:35

Colin Delane

If the files are located in a variety of different folders (perhaps by classification or other category), enter the full path to the location of the file, with a trailing backslash (“”) appended, as a test string in an adjacent column (say B).
In another column (say C), enter the following formula: =Hyperlink(B1&A1,Proper(LEFT(A1, LEN(A1) - 4)) & copy down.

As an example, if the file "cormorant.mp3" is saved in folder “C:birdwatchingsound fileswaterbirds”, this formula will link to “C:birdwatchingsound fileswaterbirdscormorant.mp3”, but display as “Cormorant”.

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.