Easy File Search with Tags and the Document Location Widget

I’m back from a long hiatus from blogging. While I was gone, I had a project that involved helping a client tag hundreds of Excel files for easier searching.

The Basics of Using Document Tags

For those of you that don’t know, you can go into the properties of an Excel file…


…then enter keywords that can be used by the built in Windows Explorer search feature.

Specifically, enter your keywords in the Tags input box under Properties (to the right of the Info screen)

In this example, I’ve tagged an Excel workbook called

MyImportantBook.xlsx with Bacon and Pork.


Once your file is tagged, you can open Windows Explorer and enter a search term. Any files tagged with your search term will pop up. You can then double-click the file to open it.


So if you’re constantly searching for files, consider tagging them in the Document Properties to help in searching.


Using VBA to tag Documents

If you’re feeling especially geeky, you can set up an Excel Table called FileTags that holds your tags.

Be sure your name the Table FileTags.

Then you can run this code to automatically add the tags you define in the table.

  1. Sub CreateDocumentTags()
  2.   Dim lstKeywords As ListObject
  3.   Dim strTags As String
  4.   Dim docTags As DocumentProperty
  6.   'capture values from the FileTags table
  7.  Set lstKeywords = ThisWorkbook.Sheets(Range("FileTags").Parent.Name).ListObjects("FileTags")
  8.   For i = 1 To lstKeywords.ListRows.Count
  9.   strTags = strTags & lstKeywords.DataBodyRange(i, 1).Value & ", "
  10.   Next i
  12.   'set document tag with the captured values
  13.  Set docTags = ThisWorkbook.BuiltinDocumentProperties("Keywords")
  14.   docTags.Value = Left(strTags, Len(strTags) - 2)
  16. End Sub


Playing with the Mysterious Document Location widget.

If you’re bored, and want to delve into quirky territory, you can play around with the Document Location widget.

You’ll first have to add it to the Quick Access Toolbar.

File->Options->Quick Access Toolbar.

You can find the Document Location widget under Commands Not in the Ribbon.


I have to be honest. This thing is practically worthless.

As far as I can tell, it’s meant to show you the full path of the currently open document.

Unfortunately, you can’t resize the widget so it’s not as useful as you would think.


The redeeming attribute of this widget is that it basically works like the Windows Explorer address bar.

So you can enter basically any path or URL to automatically open a new window with the content you request.

For instance, you can open dailydoseofexcel.com directly from Excel by simply entering the URL.


Like I said…practically worthless (I mean the widget…not dailydoseofexcel)


Interestingly enough, you can use the Document Location widget to enter a file search on the fly.

Simply enter:


Your search term goes after the query argument.

Then you can specify HOMEPATH to tell windows only look in the folders under the userid you’re logged into.

Excel will raise a warning.

Like all other warnings Excel gives me, I promptly ignore it and click YES.


Windows Explorer will pop into action, showing you all the files that match your search term (files that contain your search term or are tagged with your search term).


For the location argument, you can use any of the Windows Common File Names. For instance, this search will be limited to the Documents folder:


This search will be limited to the Application Data folder:



This is fun to play with, but I’ve yet to use this trick in any meaningful way.

Another thing I should mention is that I have not been able to get this trick to work with more than one search term at a time. There is probably more robust syntax that needs to be used, but it’s probably just easier to enter your search directly into Windows Explorer.


Wow…what a useless trick for my first blog post after 3 months.

2 thoughts on “Easy File Search with Tags and the Document Location Widget

  1. Dick Kusleika

    There are a couple of handy things about Document Location. It shows the UNC path even if you open from a mapped network drive – an otherwise difficult conversion using VBA and APIs.

    I use Doc Location for hyperlinking or attaching to emails. It’s in position 8 on my QAT, so I press Alt + 8, Ctrl + C and switch to the open email. Then I can paste that right into the File Name box on the Insert File dialog or Ctrl + K and paste it to add a hyperlink.

Leave a Reply

Your email address will not be published. Required fields are marked *