copy application path to clipboard

J

Jeff Norville

I'm simplifying the way we shoot Excel files (and other office
documents) around our office.

Ideally I thought I'd just write a little macro tied to a button to
copy/paste the full document path to the clipboard where we'd paste
that into an email. Object model suggests something this method:
Workbook.ActiveWorkbook.FullNameURLEncoded

Unfortunately, FullNameURLEncoded gives the mapped drive instead of
the UNC - i.e., z:\work\file.xlsx instead of \\server\id\work
\file.xlsx.

Any suggestions on simple sharing full document paths with UNC?

And - a related annoyance - Office 2003 made it simple to include the
HTML path to the toolbar; anybody shed insight on adding Document
Location to the Quick Access Toolbar (as I've done through Word
Options > Customize) through a macro?

Thanks,
Jeff
 
D

docksi

try this as the full path of your file:

ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
 
J

Jeff Norville

Mm - looks like using the WshNetwork Object is the way to get the full
path - hence not exactly an Excel VBA function, you might say.

People trying to do the same thing:
http://www.spyjournal.biz/exceltips/2006/06/using-outlook-and-your-intranet-to.html

Cool code inventorying UNCs curried from:
http://www.dailydoseofexcel.com/archives/2006/06/21/unc-path/
--------------------------------------
Sub NetworkMapDrive()
Dim WshNetwork As Object
Dim oDrives As Object
Dim DrivesStr As String
Dim i As Integer

Set WshNetwork = CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
DrivesStr = "Network drive Mappings:" & Chr(13)
For i = 0 To oDrives.Count - 1 Step 2
DrivesStr = DrivesStr & "Drive " & oDrives.Item(i) & " = " &
oDrives.Item(i + 1) & Chr(13)
Next
MsgBox DrivesStr
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top