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.
- Sub CreateDocumentTags()
- Dim lstKeywords As ListObject
- Dim strTags As String
- Dim docTags As DocumentProperty
- 'capture values from the FileTags table
- Set lstKeywords = ThisWorkbook.Sheets(Range("FileTags").Parent.Name).ListObjects("FileTags")
- For i = 1 To lstKeywords.ListRows.Count
- strTags = strTags & lstKeywords.DataBodyRange(i, 1).Value & ", "
- Next i
- 'set document tag with the captured values
- Set docTags = ThisWorkbook.BuiltinDocumentProperties("Keywords")
- docTags.Value = Left(strTags, Len(strTags) - 2)
- 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.
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.