Open Containing Folder in MS Word

I have an open Word document. When I hit CTRL+ALT+O on my keyboard, the folder that contains that document opens. This is very handy if I want to attach the open file to an email message by dragging and dropping the filename onto the message. It’s also very handy if there are other files in that folder that I want to open.

Tip: Always save your file before attaching it to an email message. If you attach without saving, only whatever portion that was already saved will be sent.

In my last post, I discussed four options for opening the containing folder of an open Word document. The first two required navigating the folder system. The third option required a little programming, and the fourth option (Office Tab) required $25.

For those who are interested in free option #3, here are the programming instructions courtesy of Tina Ostrander in my college’s Computer Science department. (Thanks, Tina!) The original code comes from the Code for Excel and Outlook blog. While it may look scary, it took less than 5 minutes to set it up.


Tina Ostrander writes:

In Word, select the View tab. Then Click Macros, View Macro…  Type a Macro name, then click Create:

Copy this code:

Declare Function ShellExecute Lib “shell32.dll” Alias _

  “ShellExecuteA” (ByVal hwnd As Long, ByVal lpOperation _

  As String, ByVal lpFile As String, ByVal lpParameters _

  As String, ByVal lpDirectory As String, ByVal nShowCmd _

  As Long) As Long

Sub OpenContainingFolder()

  On Error GoTo ErrorHandler

  Dim currentDocPath As String

  currentDocPath = ActiveDocument.Path

 ShellExecute 0, “open”, currentDocPath, 0, 0, 1



  Exit Sub


  MsgBox Err.Number & ” – ” & Err.Description

  Resume ProgramExit

End Sub


Into the macro window, like this [Note from Sue, highlight any existing code in the box, delete it, then paste in this code.]:

Click Save and close the window.

To run the macro, select Macro View Macros, and click Run. OR, you can assign a keyboard shortcut to the macro under File Options Customize Ribbon Keyboard Shortcuts: Customize. Scroll down to Macros on the left, select the OpenContainingFolder macro on the right, then select your keyboard shortcut. [Note from Sue: To choose your keyboard shortcut, click in the box labeled “Press new shortcut key,” then just press the keys you want to use. Tina pressed ALT+O, and you can see that in the screenshot below. I chose CTRL+ALT+O. If you choose a key combination that’s already in use, such as ALT+1, nothing will appear in the box. (ALT+1 activates whatever is in the first slot of your Quick Access Toolbar at the very top left corner of your Word window.)]

Click Assign, then Close, then OK.


That’s it! Open a Word document. Use your keyboard shortcut. The folder that contains that document will open.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply