MDauphinais1
asked on
Convert drive letter to UNC path in hyperlink field
I was given a solution in this question:
https://www.experts-exchange.com/questions/22472446/Change-Drive-Letter-to-Full-Path.html
CODE
-------
TextDrive = ServerLink
strDrive = Left(TextDrive, 2)
Dim objWMI
Set objWMI = GetObject("winmgmts:\\.\ro ot\CIMV2")
Set colDisk = objWMI.ExecQuery("Select * From Win32_LogicalDisk Where DeviceID='" & strDrive & "'")
For Each Item In colDisk
ServerLink = Replace(TextDrive, strDrive, Item.ProviderName)
Next
--------
That converts a network drive letter to a UNC path. It worked great until I tried using it on a field that was formatted for a hyperlink. I think that the automatic # symbols that are put at the beginning and end of the link are screwing it up because it doesn't do anything now. How would I modify this for a hyperlink field?
https://www.experts-exchange.com/questions/22472446/Change-Drive-Letter-to-Full-Path.html
CODE
-------
TextDrive = ServerLink
strDrive = Left(TextDrive, 2)
Dim objWMI
Set objWMI = GetObject("winmgmts:\\.\ro
Set colDisk = objWMI.ExecQuery("Select * From Win32_LogicalDisk Where DeviceID='" & strDrive & "'")
For Each Item In colDisk
ServerLink = Replace(TextDrive, strDrive, Item.ProviderName)
Next
--------
That converts a network drive letter to a UNC path. It worked great until I tried using it on a field that was formatted for a hyperlink. I think that the automatic # symbols that are put at the beginning and end of the link are screwing it up because it doesn't do anything now. How would I modify this for a hyperlink field?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome. Thanks.
replace(string, "#","")