File name and path of current workbook

Date February 15, 2008

I’ve found this useful when working on files on a department shared drive. I link it to a custom button on my toolbar, so I can just click the button and copy the full filename to the clipboard.

Sub copyFilePath()
‘ Sub copyFilePath
‘ Author: Brent Harvey
‘ Email: Excel.Examples@brentharvey.net
‘ Date: 02/20/2007
‘ Source:
http://www.cpearson.com/excel/clipboar.htm
‘ Copies path and file name of active workbook to clipboard
‘Requires Microsoft Forms 2.0 Object Library
‘Click on Tools, References and tick Microsoft Forms 2.0 Object Library

Dim MyDataObj As New DataObject
MyDataObj.SetText ActiveWorkbook.Path & “\” & ActiveWorkbook.Name
MyDataObj.PutInClipboard
End Sub

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>