PDA

View Full Version : File Browser Return Full Internet Path



nzeser
06-05-2013, 07:22 AM
I'm using Excel 2010 and based upon the online examples, have written a function called within a sub to launch a browser.

The browser is used to find a folder path and store that into a string. However, this folder path seems to be similar to when I right click a file and select "Copy Path -> Copy Long Folder". What I want is something similar to if I were to right click and select "Copy Path -> Copy Internet Path". This way if I were to save this path to a file and use another computer to open this saved folder I don't have to worry if the two computers have the path mapped to the same drive or not.

Any advice would be greatly appreciated! Here is what I have:

In the sub:
str_nPath = FN_GetFolderName

Here's the function:
Function FN_GetFolderName(Optional OpenAt As String) As String
Dim lng_Count As Long

FN_GetFolderName = vbNullString

With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = OpenAt
.Show
For lng_Count = 1 To .SelectedItems.Count
FN_GetFolderName = .SelectedItems(lng_Count)
Next lng_Count
End With
End Function

Kenneth Hobs
06-05-2013, 06:39 PM
If you mean networked drives, then UNC is the answer. http://support.microsoft.com/kb/160529