How to get current document path to clipboard in Microsoft Office applications?

1

How I can get full path of current document into clipboard when working with Microsoft Office applications? I'm mostly interested in Word and Excel.

Example:

I have open the following file in Excel:

D:\Data\Customer\Contoso\2014-12-01_Specifications.xlsx

Expected result in clipboard after getting the path:

D:\Data\Customer\Contoso\2014-12-01_Specifications.xlsx

miroxlav

Posted 2015-02-12T14:39:52.090

Reputation: 9 376

Answers

4

Place Document Location textbox on the Quick Access Toolbar. When you click there the full path can be copied.

How-to: In Excel Options window -> Quick Access Toolbar section, you can find this element in group Commands Not in the Ribbon. Highlight it and click Add >> button.

Described in How-To Show The Location of a File in the Quick Access Toolbar.

niton

Posted 2015-02-12T14:39:52.090

Reputation: 1 724

1

I accepted this answer because it gives "heavy-duty" solution. For whoever who doesn't like adding field to toolbar, you can use one-off answer for Office 2010+ or Office 2003-2007. Coders can try this.

– miroxlav – 2015-02-13T12:15:55.017

1This is the most efficient method suggested so far. After adding Document Location to Quick Access, you can copy the path to the clipboard using Alt+<Number>, Ctrl+C. – Eric Eskildsen – 2017-11-16T15:09:18.953

1

Excel maybe you can use this function (I can't test it):

LEFT(CELL("filename"),FIND("]",CELL("filename"),1)) 

For path without name of file:

cell("filename")

In Excel VBA you can use:

ThisWorkbook.Path

VBA complet and tested:

Sub aaaaa()
MsgBox ActiveDocument.Path & Application.PathSeparator & _
 ActiveDocument.Name
End Sub

Jerry1

Posted 2015-02-12T14:39:52.090

Reputation: 239

maybe use also this link

– Jerry1 – 2015-02-12T15:07:55.080

These are working, BUT I'm trying to imagine my attempts to recall the correct formula or VBA statement if I'm in hurry and need just that path quickly. Was it Document or ThisDocument or Workbook or ThisWorkbook? :) – miroxlav – 2015-02-12T15:12:23.263

I edit my post, just look. – Jerry1 – 2015-02-12T15:14:56.023

that Sub is nice but VBA macros attached to application throw warnings on every application launch because I have no certificates etc... Didn't Microsoft built in some easy out-of-the-box way achievable without coding? – miroxlav – 2015-02-12T15:20:25.960

Finally, I've found proper way which needs only clicking the mouse.

– miroxlav – 2015-02-12T15:29:14.020

1

I found the feature available for this purpose since Office 2007.
The steps below can be used in Office 2010 and higher :

  1. Open File backstage menu.

  2. Click Properties at the top of the rightmost column.

  3. Click Show Document Panel menu item.

  4. At top right corner of Document panel, there is a Location field.

  5. Copy content of the field into the clipboard.

miroxlav

Posted 2015-02-12T14:39:52.090

Reputation: 9 376

For older Office versions, see Tyler's answer.

– miroxlav – 2015-02-12T20:26:29.663

1

In both Microsoft Word and Excel, you can get the path to the current document in the Document Information Panel.

Press Alt+F+E+P

The path to the current document is in the Location field in the top, right-hand corner. Triple-click the path and copy it to your clipboard as desired.

Verified on Word/Excel 2003/2007 on Windows.

user387876

Posted 2015-02-12T14:39:52.090

Reputation:

A nice solution for older versions of Office. • Answer for Office 2010+

– miroxlav – 2015-02-12T20:24:59.980