Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Declare Function WNetGetConnection Lib "mpr.dll" _
Alias "WNetGetConnectionA" _
(ByVal lpszLocalName As String, _
ByVal lpszRemoteName As String, _
cbRemoteName As Long) As Long
Private Declare Function PathIsUNC Lib "shlwapi" _
Alias "PathIsUNCA" _
(ByVal pszPath As String) As Long
Function FileUNC(ByVal strPath As String) As String
Dim strNetPath As String
strNetPath = String(255, Chr(0))
WNetGetConnection Left(strPath, 2), strNetPath, 255
If PathIsUNC(strNetPath) Then
FileUNC = Left(strNetPath, InStr(1, strNetPath, Chr(0)) - 1) & _
Right(strPath, Len(strPath) - 2)
Else
FileUNC = strPath
End If
End Function
Sub Test()
Dim strUNC as String
strUNC = FileUNC(ActiveWorkbook.FullName)
MsgBox strUNC
End Sub