Hi all,
I'm having trouble converting the selected item from Application.Fil eDialog into a UNC Path. As many people in my office have the UNC path but mapped onto different drives, I was hoping that there would be a simple solution. I have used the website suggested in this previous post to find the UNC path - http://bytes.com/topic/access/answer...ting-hard-path.
However, I have tried to print out the full path into a message box but it will only return the start of the drive (aka in my code the MsgBox for strFinal only prints strUNCConv without the Mid(strPath, 3))
As always, all help is most appreciated!
I'm having trouble converting the selected item from Application.Fil eDialog into a UNC Path. As many people in my office have the UNC path but mapped onto different drives, I was hoping that there would be a simple solution. I have used the website suggested in this previous post to find the UNC path - http://bytes.com/topic/access/answer...ting-hard-path.
However, I have tried to print out the full path into a message box but it will only return the start of the drive (aka in my code the MsgBox for strFinal only prints strUNCConv without the Mid(strPath, 3))
As always, all help is most appreciated!
Code:
Public Sub BrowseFiles()
Dim intResult As Integer
Dim strPath As String
Dim strUNCConv As String
Dim strFinal As String
'the dialog is displayed to the user
intResult = Application.FileDialog(msoFileDialogFilePicker).Show
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
End With
'check if user has cancelled the dialog
If intResult <> 0 Then
strPath = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)
'determine if already UNC path
If Left(strPath, 2) = "\\" Then
MsgBox "Already UNC: " & strPath
Else
strUNCConv = fGetUNCPath(Mid$(strPath, 1, 2))
strFinal = strUNCConv & Mid$(strPath, 3)
MsgBox strFinal
End If
End If
End Sub
Comment