-
[VBA]Option Explicit
Declare Function WNetGetConnection32 Lib "MPR.DLL" Alias "WNetGetConnectionA" ( _
ByVal lpszLocalName As String, _
ByVal lpszRemoteName As String, _
lSize As Long) As Long
Const NO_ERROR As Long = 0
Const lBUFFER_SIZE As Long = 255
Sub test_path()
MsgBox "Z = " & GetUNCPath("Z")
End Sub
Function GetUNCPath(Driveletter As String) As String
Dim mpRemoteName As String
Dim lSize As Long
Driveletter = Driveletter & ":"
mpRemoteName = mpRemoteName & Space(lBUFFER_SIZE)
If WNetGetConnection32(Driveletter, _
mpRemoteName, _
lBUFFER_SIZE) = NO_ERROR Then
GetUNCPath = mpRemoteName
End If
End Function[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules